Specifies the size of the Buffer Access Strategy used by the VACUUM and ANALYZE commands.
At a glance
| Property | Value |
|---|---|
| Parameter | vacuum_buffer_usage_limit |
| Category | Resource Consumption |
| Default | 2MB |
| Value type | integer |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 16, 17, 18, 19 (added in 16) |
What it does
Specifies the size of the Buffer Access Strategy used by the VACUUM and ANALYZE commands. A setting of 0 will allow the operation to use any number of shared_buffers. Otherwise valid sizes range from 128 kB to 16 GB. If the specified size would exceed 1/8 the size of shared_buffers, the size is silently capped to that value. The default value is 2MB. If this value is specified without units, it is taken as kilobytes. This parameter can be set at any time. It can be overridden for vacuum and analyze when passing the BUFFER_USAGE_LIMIT option. Higher settings can allow VACUUM and ANALYZE to run more quickly, but having too large a setting may cause too many other useful pages to be evicted from shared buffers.
(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_buffer_usage_limit; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'vacuum_buffer_usage_limit';.
Tuning guidance
Raise it (e.g. 1-16MB) to let manual VACUUM/ANALYZE use a larger ring buffer and run faster on big tables; lower it to reduce shared-buffer eviction during vacuum. 0 disables the ring-buffer cap.