VACUUM เป็นกระบวนการบำรุงรักษาของ PostgreSQL ที่เรียกคืนพื้นที่จัดเก็บจาก dead tuple (เวอร์ชันของแถวที่ล้าสมัยซึ่งทิ้งไว้โดย MVCC) และอัปเดตสถิติ เนื่องจาก MVCC ของ Postgres สร้าง dead row ทุกครั้งที่ UPDATE/DELETE VACUUM จึงจำเป็นต่อการป้องกัน bloat และรักษาให้ฐานข้อมูลแข็งแรง Autovacuum ทำให้สิ่งนี้เป็นอัตโนมัติ
ทำไม dead tuple จึงมีอยู่ (ความเชื่อมโยงกับ MVCC)
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.
