Understanding and Fixing Autovacuum
summary
Explains why autovacuum misjudges work and lists concrete diagnostics and fixes: check OS tools (top/ps), inspect wait_event in pg_stat_activity and phase in pg_stat_progress_vacuum, watch IO/CPU, and detect long transactions, prepared transactions or orphaned replication slots. Fixes include raising vacuum_cost_limit (or lowering autovacuum_vacuum_cost_delay), increasing autovacuum_max_workers while scaling the cost limit, per-table autovacuum_vacuum_scale_factor, reindexing or dropping corrupted indexes, and avoiding PG_STAT_RESET; notes v12 and v16 behavior changes that affect live tuning.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 1:20How autovacuum works
- 7:04When autovacuum fails
- 13:59Fixing slow or stuck vacuum
- 26:16Fixing repeated vacuuming
- 30:26Handling skipped tables
- 40:10Q&A and conclusion
related talks
55mUnderstanding Autovacuum
32mOptimizing autovacuum: PostgreSQL’s vacuum cleaner
47mAutoVacuum - Tuning and Monitoring
59mHow Autovacuum Goes Wrong: And Can We Please Make It Stop Doing That?
48mThe Good, The Bad, and The Bloated: An Autovacuum Story
27mMaintaining Large Tables in PostgreSQL
33mPostgreSQL Observed—and Explained
19mVacuuming Enhancements in PostgreSQL 18: Faster, Smarter, More Predictable
