Indexes on papers.share_token and mistake_tags.attempt_id

Both are per-request lookups (shared-paper view, result tags, dashboard
rollup) that full-scanned. Zero warnings, 25 tests green.
This commit is contained in:
dev 2026-10-13 08:49:37 +05:30
parent 338aa2e8ef
commit 6efbb61afc

View file

@ -22,7 +22,9 @@ pub async fn init_db(pool: &SqlitePool) -> anyhow::Result<()> {
CREATE INDEX IF NOT EXISTS idx_papers_user ON papers(user_id);
CREATE INDEX IF NOT EXISTS idx_attempts_paper ON attempts(paper_id);
CREATE INDEX IF NOT EXISTS idx_attempts_user ON attempts(user_id);
CREATE INDEX IF NOT EXISTS idx_answers_attempt ON answers(attempt_id);",
CREATE INDEX IF NOT EXISTS idx_answers_attempt ON answers(attempt_id);
CREATE INDEX IF NOT EXISTS idx_papers_token ON papers(share_token);
CREATE INDEX IF NOT EXISTS idx_mistakes_attempt ON mistake_tags(attempt_id);",
)
.execute(pool)
.await?;