VACUUM, autovacuum, vacuum_cost_delay
Tune autovacuum thresholds, vacuum_cost_delay, and parallel VACUUM for big tables.
Three VACUUM Modes
VACUUM(lazy) — reclaim dead rows, update free space map, no exclusive lockVACUUM FULL— rewrite the table; exclusive lock; releases disk back to OSVACUUM ANALYZE— vacuum + refresh planner statistics in one go
Running VACUUM Manually
Sometimes useful even with autovacuum:
VACUUM (VERBOSE) orders;
VACUUM (VERBOSE, ANALYZE) orders;
VACUUM (PARALLEL 4) orders; -- parallel index cleanup (PG 13+)All lessons in this course
- MVCC and Bloat Causes
- VACUUM, autovacuum, vacuum_cost_delay
- ANALYZE and pg_statistic
- Index-Only Scans and Visibility Map