adds vacuum and analyse utility functions

This commit is contained in:
Vitor Pamplona
2025-12-27 12:11:58 -05:00
parent f9582bb007
commit f0b6fa622c
@@ -116,6 +116,18 @@ class SQLiteEventStore(
modules.reversed().forEach { it.deleteAll(db) }
}
fun vacuum() {
// 1. ANALYZE: Collects statistics about tables and indices
// to help the query planner optimize queries.
writableDatabase.execSQL("VACUUM")
}
fun analyse() {
// 2. VACUUM: Rebuilds the database file, reclaiming unused space
// and reducing fragmentation.
writableDatabase.execSQL("ANALYZE")
}
private fun innerInsertEvent(
event: Event,
db: SQLiteDatabase,