-- BTREE index on (task_status, created_at DESC) for one_pending_task query:
--   SELECT ... FROM dbtask WHERE task_status = 'PENDING' ORDER BY created_at DESC LIMIT 1
-- Also benefits all_tasks_page and zombie detection filtered by status.
CREATE INDEX IF NOT EXISTS idx_dbtask_status_created
    ON dbtask (task_status, created_at DESC);

-- BTREE index on updated_at for zombie detection:
--   SELECT ... FROM dbtask WHERE updated_at < cutoff AND task_status IN (...)
CREATE INDEX IF NOT EXISTS idx_dbtask_updated_at
    ON dbtask (updated_at);
