VACUUM هو عملية الصيانة في PostgreSQL التي تستعيد التخزين من dead tuples (إصدارات الصفوف القديمة التي تركتها MVCC) وتحدّث الإحصائيات. نظراً لأن MVCC في Postgres ينشئ صفوفاً ميتة عند كل UPDATE/DELETE، فإن VACUUM ضروري لمنع bloat والحفاظ على صحة قاعدة البيانات. Autovacuum يؤتمتة هذه العملية.
لماذا توجد dead tuples (الاتصال بـ 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.
