Parameter · Vacuuming / Cost-Based Vacuum Delay
vacuum_cost_limit
Vacuum cost amount available before napping.
- Default:
200 - Type: integer
- Range: 1 … 10000
- Applies: Session (any user)
In plain words
The size of VACUUM's budget between naps. A bigger budget means more pages per nap, so a faster but more I/O-hungry vacuum. Autovacuum uses this value too unless autovacuum_vacuum_cost_limit is set.
For DBAs and operators
Because autovacuum_vacuum_cost_limit defaults to -1, this 200 is effectively the total budget shared by all autovacuum workers. With the 2 ms autovacuum delay, 200 points allows only about 40 MB/s of dirtied pages for all workers together, often too little for large, busy databases on SSDs.
Typical tuning
- Modern SSD/NVMe: 1000–4000 (set
autovacuum_vacuum_cost_limitexplicitly so manual VACUUM is unaffected). - Watch disk utilisation and replica lag after raising it: vacuum also generates WAL.
- Signs it is too low: autovacuum workers always busy,
wait_event = VacuumDelayinpg_stat_activity, risingn_dead_tup.
SELECT pid, wait_event, query FROM pg_stat_activity
WHERE backend_type = 'autovacuum worker';Since PostgreSQL 16 a config reload updates the cost settings of already-running autovacuum workers.
How to change it
Any user can change it for their session with SET.
See it in context
Related parameters
autovacuum_vacuum_cost_limit vacuum_cost_delay vacuum_cost_page_dirty autovacuum_max_workers