Skip to content

autovacuum_work_mem

The memory ceiling for each autovacuum worker, with -1 meaning that the worker inherits maintenance_work_mem.
Note

Fact — official short description: “Sets the maximum memory to be used by each autovacuum worker process.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , ValuekB
Raw unit
Range , Value-12147483647
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueResource Usage / Memory
Upstream classification
Latest boot value , Value-1
-1 kB

Lifecycle

Fact Value
First observed PG9.4
Present in PG9.4–19 Beta 3
Removed in No
Introduction commit 8693559cacf1 — New autovacuum_work_mem parameter
Commit date 2013-12-12
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.4–19 Beta 3 -1 kB -1 kB

How it works

autovacuum_work_mem applies separately to each autovacuum worker process. The default sentinel -1 means to use maintenance_work_mem rather than negative memory.

The setting affects autovacuum workers only; it does not change manually issued VACUUM. It is a SIGHUP-context parameter, so it is configured at server level rather than as a per-session tuning knob.

Because multiple workers can run concurrently, the aggregate potential allocation is the per-worker value multiplied by active autovacuum workers. Memory is only one part of vacuum behavior; I/O throttling, worker count, thresholds, and table activity also matter.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP When maintenance_work_mem is large, set an explicit lower autovacuum ceiling unless the concurrent-worker budget clearly fits. Watch vacuum duration, dead-tuple backlog, and latency before increasing it.
OLAP Large relations may justify more memory per worker, but schedule and worker concurrency can dominate. Coordinate the value with autovacuum_max_workers and the maintenance window.
Small nodes Keep -1 only when maintenance_work_mem is itself conservative; otherwise set a smaller explicit value to prevent several workers from exhausting the host.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.4–19 Beta 3 unmodified; OLAP: PG9.4–19 Beta 3 unmodified; CRIT: PG9.4–19 Beta 3 unmodified; TINY: PG9.4–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Reading -1 as a literal negative kilobyte value instead of an inheritance sentinel.
  • Assuming the setting controls manual VACUUM.
  • Budgeting one worker while several autovacuum workers can run at once.
  • Increasing memory to address a vacuum problem actually caused by I/O throttling, thresholds, locks, or insufficient worker capacity.

maintenance_work_mem · autovacuum_max_workers · autovacuum_worker_slots · vacuum_buffer_usage_limit · autovacuum_vacuum_cost_delay

References