Parameter · Vacuuming / Automatic Vacuuming
autovacuum_worker_slots
Sets the number of backend slots to allocate for autovacuum workers.
- Default:
16 - Type: integer
- Range: 1 … 262143
- Applies: Restart required
In plain words
New in PostgreSQL 18. At startup the server reserves room (shared memory and semaphores) for this many autovacuum workers. autovacuum_max_workers can then be changed with a simple reload, as long as it stays within these slots.
For DBAs and operators
Slots are allocated once at server start, so changing this needs a restart. The default of 16 (initdb may pick less if the kernel lacks semaphores) gives head-room to raise autovacuum_max_workers from 3 up to 16 without downtime.
- Setting
autovacuum_max_workershigher than the slots does nothing beyond the slot count (a WARNING says the server will only start up to that many workers). - Slots count toward the process total used for semaphores (num_os_semaphores) and shared memory, but unlike
max_connectionsthey are not used by clients. - Practical rule: set it to the most workers you can ever imagine needing (e.g. 16–32 on large hosts), then tune
autovacuum_max_workerslive.
SHOW autovacuum_worker_slots;
SELECT name, setting, pending_restart FROM pg_settings
WHERE name IN ('autovacuum_worker_slots','autovacuum_max_workers');How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.