autovacuum_max_workers
How many autovacuum workers can run at the same time.
- Standard
3- Range
- 1 to autovacuum_worker_slots (262143 maximum)
- Restart needed
- Nein
- Default checked on
- PostgreSQL 18
Was es bewirkt
Each worker vacuums one table at a time. From PostgreSQL 18 it can be raised with a reload up to autovacuum_worker_slots (default 16); before 18 it needed a restart.
Standardwert
3. 3 (PostgreSQL 18). Context changed from postmaster to sighup in 18.
Check the current value
SHOW autovacuum_max_workers; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'autovacuum_max_workers';
Change it
ALTER SYSTEM SET autovacuum_max_workers = 6; 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
Databases with many busy tables where pg_stat_user_tables shows n_dead_tup climbing and last_autovacuum lagging. More workers share the same cost limit, so raise autovacuum_vacuum_cost_limit too.
What can go wrong
Without a higher cost limit, more workers each run slower; with one, they add I/O.
Questions about autovacuum_max_workers
What is the default value of autovacuum_max_workers in PostgreSQL?
3. 3 (PostgreSQL 18). Context changed from postmaster to sighup in 18.
Does changing autovacuum_max_workers 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_max_workers?
Databases with many busy tables where pg_stat_user_tables shows n_dead_tup climbing and last_autovacuum lagging. More workers share the same cost limit, so raise autovacuum_vacuum_cost_limit too.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check autovacuum_max_workers 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.