MCPcopy Index your code
hub / github.com/cameri/nostream / createHotPathIndexes

Function createHotPathIndexes

scripts/verify-index-impact.ts:157–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155}
156
157async function createHotPathIndexes(): Promise<void> {
158 console.log('after: creating hot-path indexes')
159 // Shape must match migrations/20260420_120000_add_hot_path_indexes.js
160 // exactly, otherwise the before/after numbers are meaningless.
161 await client.query(`CREATE INDEX IF NOT EXISTS events_active_pubkey_kind_created_at_idx
162 ON events (event_pubkey, event_kind, event_created_at DESC, event_id)`)
163 await client.query(`CREATE INDEX IF NOT EXISTS events_deleted_at_partial_idx
164 ON events (deleted_at) WHERE deleted_at IS NOT NULL`)
165 await client.query(`CREATE INDEX IF NOT EXISTS invoices_pending_created_at_idx
166 ON invoices (created_at) WHERE status = 'pending'`)
167 await client.query('ANALYZE events')
168 await client.query('ANALYZE invoices')
169}
170
171async function pickSamplePubkey(): Promise<Buffer | undefined> {
172 // Production REQ does not filter on deleted_at, so pick the densest pubkey

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected