-- 221_study_q_related_stale_idx.sql
-- 워커가 stale (related_computed_at IS NULL) 행을 토픽별로 빠르게 찾기 위한 partial index.

CREATE INDEX IF NOT EXISTS idx_study_q_related_stale
    ON study_questions (study_topic_id, related_computed_at)
    WHERE deleted_at IS NULL AND embedding_status = 'ready' AND related_computed_at IS NULL;
