Performing Database Maintenance
Because you’ve created a large number of updates, new row versions have replaced old ones, and those old ones are no longer needed. Remember row versions are immutable in PostgreSQL. The former version is now a “dead” row since no transaction will refer to it. The space it consumes contributes to bloat and that space could be re-used for storing other tuples from inserts and updates.
Autovacuum manages this for you, running with different processes in the background. Autovacuum uses a scheduler system and thresholds, running VACUUM operations once thresholds are met.
For manual operations like direct updates, you can intervene here and manually run VACUUM to ensure that it runs and does not wait around for thresholds ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access