Vacuum Best Practices
Healthy vacuum is invisible until it fails. Follow this checklist to stay ahead of bloat, wraparound, and index-only scan regressions on PostgreSQL 18.4.
Search across all documentation pages
Healthy vacuum is invisible until it fails. Follow this checklist to stay ahead of bloat, wraparound, and index-only scan regressions on PostgreSQL 18.4.
age(datfrozenxid) and high n_dead_tup ratios.autovacuum_vacuum_scale_factor on large hot tables. Default 20% is too slow at scale.autovacuum_max_workers. Avoid vacuum/OLTP fights.VACUUM ANALYZE after bulk delete or COPY. Before reopening BI.idle_in_transaction_session_timeout on app roles. Long transactions block freeze.pg_stat_activity.xact_start in incidents. Correlate vacuum lag.pg_repack or partition swap for OS-level shrink. When live rows << file size.fillfactor on extreme update tables. Plan for HOT updates.SELECT * on TOAST-wide tables. Cut I/O at source.age(datfrozenxid) and top age(relfrozenxid). Wraparound early warning.Stack versions: This page was written for PostgreSQL 18.4 (stable 18, maintenance 17), pgvector 0.8+, PgBouncer 1.x, Patroni 3.x, and PostGIS 3.5+.
Reviewed by Chris St. John·Last updated Jul 18, 2026