commit 98c1f18bd96da593e9a543d114d5a5ab6a87f8ee
parent c10f666365815cb5f4bb33e3de3ee34e8930c29b
Author: Silas Brack <silasbrack@gmail.com>
Date: Sun, 7 Jun 2026 23:06:43 +0200
perf: add indices on story.published and story.score
At 1M rows, feed queries did a full table scan + temp sort.
Index on (published DESC) and (score DESC, published DESC)
brings feed from ~140ms to ~35ms at 1M rows.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/traildepot/migrations/main/U104__story_indices.sql b/traildepot/migrations/main/U104__story_indices.sql
@@ -0,0 +1,2 @@
+CREATE INDEX idx_story_published ON story (published DESC);
+CREATE INDEX idx_story_score ON story (score DESC, published DESC);