fix(manager-core): F-M-001 drop unused idx_cron_triggers_due
Migration 0017_cron_triggers.sql created idx_cron_triggers_due on (last_fired_at) with a comment claiming it serves the scheduler. The actual scheduler query has no last_fired_at predicate — it filters purely on `t.enabled = TRUE FOR UPDATE OF d SKIP LOCKED`. The index has been pure write amplification with no read payoff. Migration 0037 drops it. Reversible by re-running 0017's CREATE INDEX if the planner story ever changes. AUDIT.md anchor: F-M-001. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
-- F-M-001 (audit 2026-06-07): drop idx_cron_triggers_due.
|
||||
--
|
||||
-- Created in 0017_cron_triggers.sql with a comment claiming it serves
|
||||
-- the scheduler. The actual scheduler query is
|
||||
-- `... WHERE t.enabled = TRUE FOR UPDATE OF d SKIP LOCKED` — no
|
||||
-- `last_fired_at` predicate. The index is unused; the join is
|
||||
-- effectively a full table scan of cron details against enabled
|
||||
-- triggers (small N today, so the overhead is invisible — but the
|
||||
-- index is also pure write amplification with zero read payoff).
|
||||
--
|
||||
-- Drop is reversible by re-running the CREATE INDEX from 0017.
|
||||
DROP INDEX IF EXISTS idx_cron_triggers_due;
|
||||
Reference in New Issue
Block a user