6. VACUUM Processing
Vacuum processing is a maintenance process that ensures the persistent operation of PostgreSQL. Its two main tasks are removing dead tuples and freezing transaction IDs. Section 5.10 briefly mentions both tasks.
PostgreSQL provides two modes to remove dead tuples: Concurrent VACUUM and Full VACUUM.
Concurrent VACUUM, often simply called VACUUM, removes dead tuples from each page of the table file. Other transactions can read the table while this process runs.
In contrast, Full VACUUM removes dead tuples and defragments live tuples across the entire file. Other transactions cannot access tables while Full VACUUM runs.
Although vacuum processing is essential for PostgreSQL, its functionality improved slowly compared to other features. For example, until version 8.0, users had to execute this process manually using the psql utility or the cron daemon. Automation occurred in 2005 with the implementation of the autovacuum daemon.
Because vacuum processing scans entire tables, it is a costly process. In version 8.4 (2009), PostgreSQL introduced the Visibility Map (VM) to improve the efficiency of dead tuple removal. In version 9.6 (2016), an enhanced VM further improved the freeze process.