Files
usenet-indexer/database/migrations/1770000002400_probe_candidates_kind_index.ts
T
Daan MeijerandClaude Opus 5.5 3301216aa8
Test and deploy / test (push) Successful in 56s
Test and deploy / edge (push) Successful in 2m3s
Test and deploy / deploy (push) Successful in 3m27s
Probe candidates: an index on (kind, id) of the waiting ones for the prober's claims
A slice of a claim filtered ~700k rows by kind through the id index (0.37 s
a slice, 20 slices and up to 5 tiers a claim, the lanes waiting meanwhile).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 10:33:27 +02:00

20 lines
730 B
TypeScript

import { BaseSchema } from '@adonisjs/lucid/schema'
/**
* The prober claims waiting candidates by kind from random points of the
* queue (Prober.claim): by the id index alone a slice filtered ~700k rows for
* the rarer kinds (0.37 s a slice, 20 slices and up to 5 tiers a claim, the
* lanes waiting meanwhile; LOG.md 2026-10-12 (17)). Built concurrently.
*/
export default class extends BaseSchema {
static disableTransactions = true
async up() {
this.schema.raw(`CREATE INDEX CONCURRENTLY IF NOT EXISTS probe_candidates_kind_waiting_idx ON probe_candidates (kind, id) WHERE status = 'waiting'`)
}
async down() {
this.schema.raw(`DROP INDEX CONCURRENTLY IF EXISTS probe_candidates_kind_waiting_idx`)
}
}