Configuration parameter

vacuum_cost_delay — PostgreSQL configuration parameter

Category Vacuuming Default 0, which disables the cost-based vacuum delay feature

The amount of time that the process will sleep when the cost limit has been exceeded.

At a glance

Property Value
Parameter vacuum_cost_delay
Category Vacuuming
Default 0
Value type floating point
Change scope Per-session (SET)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

The amount of time that the process will sleep when the cost limit has been exceeded. If this value is specified without units, it is taken as milliseconds. The default value is 0, which disables the cost-based vacuum delay feature. Positive values enable cost-based vacuuming.

When using cost-based vacuuming, appropriate values for vacuum_cost_delay are usually quite small, perhaps less than 1 millisecond. While vacuum_cost_delay can be set to fractional-millisecond values, such delays may not be measured accurately on older platforms. On such platforms, increasing VACUUM’s throttled resource consumption above what you get at 1ms will require changing the other vacuum cost parameters. You should, nonetheless, keep vacuum_cost_delay as small as your platform will consistently measure; large delays are not helpful.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW vacuum_cost_delay; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'vacuum_cost_delay';.

Tuning guidance

This is the master throttle for vacuum I/O. Raise it to make (auto)vacuum gentler on a busy server; lower it (or 0) to let vacuum finish faster during maintenance windows. Tune with vacuum_cost_limit.

Reference

PostgreSQL documentation — vacuum_cost_delay.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters