Parameter · Resource Usage / Memory
autovacuum_work_mem
Sets the maximum memory to be used by each autovacuum worker process. -1 means use "maintenance_work_mem".
- Default:
-1 - Type: integer (kB)
- Range: -1 … max (2147483647)
- Applies: Reload
In plain words
Lets you give autovacuum workers a different memory budget than manual maintenance commands. The default -1 means "same as maintenance_work_mem". Each running worker can use this much.
For DBAs and operators
Only affects autovacuum workers, not manual VACUUM. Total worst case is autovacuum_max_workers × autovacuum_work_mem, which is why some teams keep maintenance_work_mem high for manual work (index builds, restores) and set this lower, or the reverse.
Too small means repeated index passes on big tables with many dead rows: check index_vacuum_count in pg_stat_progress_vacuum and index scans: N in the autovacuum log (with log_autovacuum_min_duration). Since PostgreSQL 17 the dead-TID store is far more compact and can exceed 1 GB, so 256 MB–1 GB covers very large tables. Explicit values below 64 kB are silently raised to 64 kB.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().
See it in context
Autovacuum: when tables get vacuumed Autovacuum launcher and workers VACUUM Memory architecture Local (per-backend) memory
Related parameters
maintenance_work_mem autovacuum_max_workers log_autovacuum_min_duration