VACUUM è il processo di manutenzione di PostgreSQL che recupera spazio dalle dead tuple (versioni di righe obsolete lasciate da MVCC) e aggiorna le statistiche. Poiché MVCC di Postgres crea righe morte ad ogni UPDATE/DELETE, VACUUM è essenziale per prevenire il bloat e mantenere il database in salute. Autovacuum lo automatizza.
Perché è importante
MVCC: an UPDATE/DELETE doesn't overwrite a row — it marks the old version obsolete
(a "dead tuple") and may create a new one. Dead tuples accumulate over time.
→ Without cleanup, dead tuples cause BLOAT: wasted disk space, slower scans
(more data to read), degraded performance.
VACUUM reclaims this dead space → keeps tables compact and queries fast.
