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 documentation: VACUUM


Management / adminstration, Performance, SQL command, Utility command, Vacuuming

See also

vacuumdb, autovacuum, ANALYZE, pg_stat_progress_vacuum