perf(db): optimize D1 indexes to eliminate full table scans (#214)
* perf(db): optimize D1 indexes to eliminate full table scans - Add composite indexes to ec_* tables for common query patterns - Replace single-column indexes with (deleted_at, updated_at, id) composite - Add (deleted_at, status) index for count queries - Add (deleted_at, created_at, id) index for chronological ordering - Optimize comment counting with partial indexes per status - Rewrite countByStatus() to use parallel WHERE queries instead of GROUP BY Fixes #131 * chore: add changeset for D1 index optimization * style: wrap changeset description for formatting compliance
This commit is contained in:
8
.changeset/optimize-d1-indexes.md
Normal file
8
.changeset/optimize-d1-indexes.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"emdash": patch
|
||||
---
|
||||
|
||||
Optimizes D1 database indexes to eliminate full table scans in admin panel. Adds
|
||||
composite indexes on ec_\* content tables for common query patterns (deleted_at +
|
||||
updated_at/created_at + id) and rewrites comment counting to use partial indexes.
|
||||
Reduces D1 row reads by 90%+ for dashboard operations.
|
||||
Reference in New Issue
Block a user