Expand description
Upkeep for a long-lived SQLite database: query-planner statistics and consistent snapshots.
Both work on any pool, so an application that keeps its own tables in the same file as the run store (as the aidaemon daemon does) maintains the whole file with one call.
use aidaemon_store_sqlite::maintenance::{optimize, snapshot, Optimize};
optimize(&pool, Optimize::AtOpen).await?; // once, after migrations
optimize(&pool, Optimize::Periodic).await?; // every few hours
snapshot(&pool, "backups/app.db".as_ref()).await?;Enums§
Constants§
- ANALYSIS_
LIMIT - Rows sampled per index when statistics are gathered. Bounds the cost of
an analysis on a large table to milliseconds, as SQLite recommends for
PRAGMA optimize; the estimates stay good enough to pick indexes.