/explain/autovacuum_vacuum_cost_limit

autovacuum_vacuum_cost_limit

The size of the token budget: cost units the worker may spend before sleeping autovacuum_vacuum_cost_delay. Default 200, which with 2 ms delay caps a vacuum at roughly 100,000 units per second: fast for cached pages, slow the moment pages are dirtied. All autovacuum workers share this budget between them, so raising worker count without raising the limit makes each worker slower. Production values on large tables run 600 to a few thousand.

DEMO — one vacuum pass, toy table14 GB heap · 1,740,000 pages
defaults (200 · 2 ms)1 min · 154.7 MB/s
sliders15 min · 15.5 MB/s
autovacuum_vacuum_cost_limit200
cost units the worker may spend before it sleeps · default 200
autovacuum_vacuum_cost_delay20 ms
how long it sleeps · default 2 ms since Postgres 12, 20 ms before
cost = pages × (0.55·hit + 0.25·miss + 0.20·dirty) · duration = cost / limit × delay
SEE ALSO
autovacuum_vacuum_cost_delayautovacuum_max_workers← back to start
The real constraint is usually replication lag and WAL volume, not local I/O: a fast vacuum is a WAL burst the replicas must absorb.
autovacuum_vacuum_cost_limit — robovac