Skip to main content

spawn_analyze

Function spawn_analyze 

Source
pub fn spawn_analyze(pool: DbPool, actor: &str) -> Result<Uuid, String>
Expand description

Spawns a background job that refreshes the query planner’s statistics with ANALYZE over the high-churn tables. After a bulk import or a large rerun churns tasks.status, stale statistics can make the planner mis-estimate and skip the right index (e.g. the TODO leasing index, todo_index), so an operator can refresh them on demand instead of waiting for autovacuum’s next pass (DB ongoing-maintenance; docs/DB_TUNING.md). ANALYZE is online (a brief lock per table, sampling only) and runs off the request path, reporting per-table progress. Debounced: an analyze already queued/running is reused.