Parameter · Vacuuming / Automatic Vacuuming
autovacuum_vacuum_cost_delay
Vacuum cost delay in milliseconds, for autovacuum. -1 means use "vacuum_cost_delay".
- Default:
2ms - Type: real (ms)
- Range: -1 … 100ms
- Applies: Reload
In plain words
Autovacuum is throttled by default so it does not disturb your queries: after spending its cost budget a worker naps for 2 ms. Shorter naps or 0 make autovacuum faster; longer naps make it gentler but it may fall behind.
For DBAs and operators
-1 means "use vacuum_cost_delay" (0 by default, i.e. unthrottled). The default was 20 ms up to PostgreSQL 11 and is 2 ms since PostgreSQL 12; configurations carried over from old versions with 20 ms are a classic cause of autovacuum never keeping up.
Per table: ALTER TABLE big SET (autovacuum_vacuum_cost_delay = 0) exempts that table from throttling (and from cost balancing between workers).
Observe
wait_event = 'VacuumDelay'on autovacuum workers inpg_stat_activity.- PostgreSQL 18:
track_cost_delay_timing = onaddsdelay_timetopg_stat_progress_vacuumand to autovacuum log output. - Autovacuum log lines:
avg read rate: … MB/s, avg write rate: … MB/s.
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_limit vacuum_cost_delay vacuum_cost_limit track_cost_delay_timing