VACUUM PostgreSQL की रखरखाव प्रक्रिया है जो dead tuples (MVCC द्वारा छोड़े गए अप्रचलित row versions) से storage पुनः प्राप्त करती है और statistics अपडेट करती है। चूँकि Postgres का MVCC हर UPDATE/DELETE पर dead rows बनाता है, bloat को रोकने और database को स्वस्थ रखने के लिए VACUUM आवश्यक है। Autovacuum इसे स्वचालित करता है।
Dead tuples क्यों मौजूद होते हैं (MVCC connection)
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.
