Run VACUUM on a Table
pg_vacuumReclaim dead-tuple storage and optimize table performance using VACUUM, VACUUM ANALYZE, or VACUUM FULL. Choose between non-blocking reclamation, statistics update, or full rewrite with exclusive lock.
Instructions
Execute VACUUM, VACUUM ANALYZE, or VACUUM FULL on a table to reclaim dead-tuple storage.
Modes:
standard: Reclaims dead-tuple space for reuse within the table (non-blocking)
analyze: VACUUM + updates query planner statistics (recommended for most cases)
full: Rewrites the table to reclaim disk space to OS — requires exclusive lock, very slow on large tables
Args:
table: Table name (required)
schema: Schema name (default: public)
mode: 'standard', 'analyze', or 'full' (default: analyze)
confirm_full: Required when mode is 'full' — acknowledges table will be locked
Returns: Duration and confirmation of completion.
Warning: VACUUM FULL acquires an exclusive lock — all queries on the table will block until it completes. Use during maintenance windows only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table to vacuum | |
| schema | No | Schema name (default: public) | public |
| mode | No | 'standard', 'analyze', or 'full' | analyze |
| confirm_full | No | Required when mode=full — confirms exclusive lock accepted |