VACUUM
A utility command for carrying out garbage collection on a database
VACUUM
is a utility command for manually carrying out garbage collection on a database. It can be optionally combined with the ANALYZE
command for collecting table statistics.
VACUUM
has always present in PostgreSQL. It is a PostgreSQL extension and is not part of the SQL standard.
VACUUM and autovacuum
Since PostgreSQL 8.1, regular garbage collection and statistics collection is automatically carried out by the autovacuum process.
Monitoring VACUUM progress
Since PostgreSQL 9.6, the progress reporting view pg_stat_progress_vacuum
provides a way of monitoring the status of a VACUUM
operation.
Change history
- PostgreSQL 16
- options
SKIP_DATABASE_STATS
andONLY_DATABASE_STATS
added (commit a46a7011)
- options
- PostgreSQL 14
- PostgreSQL 13
- option
PARALLEL
added (commit 40d964ec)
- option
- PostgreSQL 12
- PostgreSQL 9.6
- option
DISABLE_PAGE_SKIPPING
added (commit ede62e56)
- option
- PostgreSQL 9.0
- PostgreSQL 7.2
- PostgreSQL 6.1
- option
ANALYZE
added (commit 24d48db3)
- option
References
- PostgreSQL documentation: VACUUM