// postgresql · memory

autovacuum_work_mem

Memory each autovacuum worker uses to track dead rows; -1 means use maintenance_work_mem.

По умолчанию
-1
Range
-1, or 64kB to 2TB
Restart needed
Нет
Default checked on
PostgreSQL 18

Что оно делает

Lets you give manual maintenance a large maintenance_work_mem without multiplying it across every autovacuum worker.

Значение по умолчанию

-1. -1, meaning inherit maintenance_work_mem (PostgreSQL 18).

Check the current value

SHOW autovacuum_work_mem;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'autovacuum_work_mem';

Change it

ALTER SYSTEM SET autovacuum_work_mem = '512MB';
SELECT pg_reload_conf();

No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

When to change it

Set it explicitly when maintenance_work_mem is large (several GB) and autovacuum_max_workers is above the default.

What can go wrong

Too small makes autovacuum scan every index several times on big tables, which is slow and I/O heavy.

Questions about autovacuum_work_mem

What is the default value of autovacuum_work_mem in PostgreSQL?

-1. -1, meaning inherit maintenance_work_mem (PostgreSQL 18).

Does changing autovacuum_work_mem require a restart?

No. No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

When should I change autovacuum_work_mem?

Set it explicitly when maintenance_work_mem is large (several GB) and autovacuum_max_workers is above the default.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check autovacuum_work_mem on your own server

SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.