Command
VACUUM
PostgreSQL maintenance command that reclaims space from dead tuples and updates the visibility map so MVCC stays efficient.
Under MVCC, every UPDATE and DELETE leaves behind a dead row version. VACUUM walks tables and indexes, marks dead tuples as reusable, and refreshes the visibility map so Index Only Scans can skip the heap.
Most databases rely on autovacuum — a background worker that triggers VACUUM and ANALYZE when dead-tuple counts cross thresholds. Manual VACUUM is sometimes useful for ad-hoc cleanup; VACUUM FULL rewrites a table to fully reclaim space but takes an exclusive lock and should be used sparingly.
Without sufficient vacuuming, tables and indexes grow ever larger relative to the live row count (“bloat”) and queries get slower over time.