DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Vacuuming / Automatic Vacuuming

autovacuum_vacuum_cost_limit

Vacuum cost amount available before napping, for autovacuum. -1 means use "vacuum_cost_limit".

  • Default: -1
  • Type: integer
  • Range: -1 … 10000
  • Applies: Reload

In plain words

The budget autovacuum spends between naps. It is shared: if three workers run, each gets about a third. Raising it is the usual way to let autovacuum keep up on busy systems with fast disks.

For DBAs and operators

-1 means use vacuum_cost_limit (200). Since PostgreSQL 16 the budget is split evenly among the running workers (each uses limit / number of balanced workers; tables with per-table cost settings are excluded), so the sum stays at this value. Raising autovacuum_max_workers without raising this limit does not make autovacuum faster overall.

Sizing

Write budget ≈ limit / vacuum_cost_page_dirty × 8 kB × (1000 / delay_ms): 200 → ~40 MB/s, 2000 → ~400 MB/s (with 2 ms delay). Typical production values on SSD: 1000–3000. Increase step by step and watch I/O latency, WAL volume and replication lag.

ALTER SYSTEM SET autovacuum_vacuum_cost_limit = 2000;
SELECT pg_reload_conf();   -- applies to running workers too (PG16+)
-- per table
ALTER TABLE orders SET (autovacuum_vacuum_cost_limit = 4000);

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

Autovacuum: when tables get vacuumed Autovacuum launcher and workers

Related parameters

autovacuum_vacuum_cost_delay vacuum_cost_limit autovacuum_max_workers vacuum_cost_page_dirty

All Vacuuming parameters