PostgreSQL dùng MVCC: khi update/delete, nó không xóa ngay mà để lại "dead tuple" (phiên bản cũ của dòng) cho các transaction đang đọc bản cũ. VACUUM là việc dọn rác đó: thu hồi chỗ trống để tái dùng và cập nhật visibility map. Autovacuum là tiến trình tự chạy nền làm việc này để tránh phình bảng (bloat) và tránh sự cố "transaction ID wraparound".
Đừng tắt autovacuum tùy tiện. Nếu một bảng ghi nhiều bị phình hoặc query chậm dần, hãy kiểm tra cấu hình autovacuum, các transaction chạy quá lâu (chặn dọn rác), bloat của index, và chạy VACUUM (ANALYZE) khi cần.
PostgreSQL uses MVCC: on update/delete it does not erase immediately but leaves a "dead tuple" (the old version of the row) for transactions still reading the old data. VACUUM is the cleanup: it reclaims that space for reuse and updates the visibility map. Autovacuum is the background process doing this automatically to prevent table bloat and "transaction ID wraparound".
Do not casually disable autovacuum. If a write-heavy table bloats or queries slow over time, check autovacuum settings, long-running transactions (which block cleanup), index bloat, and run VACUUM (ANALYZE) when needed.