select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / RESOURCE USAGE

autovacuum_work_mem

Read PG 18 manual ↗

Specifies the maximum amount of memory to be used by each autovacuum worker process.

Type
integer
Context
sighup
Measured default
-1 kB
Unit
kB
Metadata snapshot
18

Definition PG 18 manual

Specifies the maximum amount of memory to be used by each autovacuum worker process. If this value is specified without units, it is taken as kilobytes. It defaults to -1, indicating that the value of maintenance_work_mem should be used instead. The setting has no effect on the behavior of VACUUM when run in other contexts. This parameter can only be set in the postgresql.conf file or on the server command line.

Measured default history
Version intervalDefault
9.4 – 19-1 kB
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

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.

Operational considerations

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.

Workload guidance

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.

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.

SMALL: Keep -1 only when maintenance_work_mem is itself conservative; otherwise set a smaller explicit value to prevent several workers from exhausting the host.

Version history 5
  1. PG 17 → 18changed
  2. PG 16 → 17changed
  3. PG 11 → 12changed
  4. PG 9.5 → 9.6changed
  5. PG 9.3 → 9.4added

Related entries

Further reading

Definition snapshot: english-manuals:139f237fac6783add0df830ea39… · English manual source