VACUUM
In the previous sections, you learned how PostgreSQL exploits MVCC to store different versions of the same data (tuples) that different transactions can perceive, depending on their active snapshot. However, keeping different versions of the same tuples requires extra space with regard to the last active version, and this space could fill your storage sooner or later. To prevent that, and reclaim storage space, PostgreSQL provides an internal tool named VACUUM
, the aim of which is to analyze stored tuple versions and remove the ones that are no longer perceivable.
Remember: a tuple is not perceivable (visible) when there are no more active transactions that can reference the version, which means having the tuple version within their snapshot. A not-perceivable tuple is often called a dead tuple, marking the fact that it is not required anymore in the database life cycle.
VACUUM
can be an I/O-intensive operation, since it must reclaim and free disk space...