Add flag to optimize db. Remove ANALYZE on startup.

Entire-Checkpoint: d49917ff4b10
This commit is contained in:
2026-03-12 20:12:49 +01:00
parent 7f069f1ec1
commit 0e27624d73
3 changed files with 16 additions and 9 deletions

View File

@@ -49,14 +49,6 @@ func setupSqlite(db *sql.DB, cfg *RepositoryConfig) error {
}
}
// Update query planner statistics so SQLite picks optimal indexes.
// Without this, SQLite guesses row distributions and often chooses wrong
// indexes for queries with IN clauses + ORDER BY, causing full table sorts
// in temp B-trees instead of using covering indexes.
if _, err := db.Exec("ANALYZE"); err != nil {
cclog.Warnf("Failed to run ANALYZE: %v", err)
}
return nil
}