DROP INDEX IF EXISTS ai_jobs_pending_claim_idx;

CREATE INDEX IF NOT EXISTS ai_jobs_pending_claim_idx
    ON ai_jobs (status, priority DESC, scheduled_at DESC, created_at DESC)
    WHERE status = 'pending';
