-- 189_study_question_attempts_idx_question.sql (4/5)
-- 문제별 시도 이력 조회 (가장 최근 attempt, 누적 통계).
-- DISTINCT ON (study_question_id) ORDER BY answered_at DESC 패턴에 사용 — wrong_only=latest_wrong 동작의 핵심.

CREATE INDEX IF NOT EXISTS idx_study_question_attempts_question
    ON study_question_attempts (study_question_id, answered_at DESC);
