-- Retention runs after each scheduler receipt; avoid scanning the complete history. -- On a busy existing installation, pre-create this same index CONCURRENTLY -- outside a transaction before deploying (deploy/PRODUCTION-RETENTION-INDEX.md). CREATE INDEX IF NOT EXISTS idx_scheduler_runs_finished_at ON scheduler_runs (finished_at);