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>
This commit is contained in:
1 parent
0727afe968
commit
3301216aa8
1 file changed
+19
@@ -0,0 +1,19 @@
|
|||||||
|
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`)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user