Skip to main content

optimize

Function optimize 

Source
pub async fn optimize(pool: &SqlitePool, when: Optimize) -> Result<(), Error>
Expand description

Gather the query planner’s statistics where they are missing or stale.

Without them SQLite picks indexes by rule of thumb, which goes wrong on tables that have grown unevenly. The pass is bounded by ANALYSIS_LIMIT, and when nothing changed it does nothing.