mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-03-15 04:17:30 +01:00
Add flag to optimize db. Remove ANALYZE on startup.
Entire-Checkpoint: d49917ff4b10
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user