Wiki / Configuration Parameters
maintenance_work_mem
Specifies the maximum amount of memory to be used by maintenance operations, such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY. If this value is specified without units, it is taken as kilobytes. It defaults to 64 megabytes (64MB). Since only one of these operations can be executed at a time by a database session, and an installation normally doesn't have many of them running concurrently, it's safe to set this value significantly larger than work_mem. Larger settings might improve performance for vacuuming and for restoring database dumps. Note that when autovacuum runs, up to autovacuum_max_workers times this memory may be allocated, so be careful not to set the default value too high. It may be useful to control for this by separately setting autovacuum_work_mem.
English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- boot val
- 65536
- category
- Resource Usage / Memory
- context
- user
- documented
- true
- enumvals
- Unknown
- extra desc
- This includes operations such as VACUUM and CREATE INDEX.
- lang
- en
- max val
- 2147483647
- metadata version
- 18
- min val
- 64
- name
- maintenance_work_mem
- short desc
- Sets the maximum memory to be used for maintenance operations.
- source
- pg-settings-source-snapshot
- unit
- kB
- vartype
- integer
Definition PG 18
Specifies the maximum amount of memory to be used by maintenance operations, such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY. If this value is specified without units, it is taken as kilobytes. It defaults to 64 megabytes (64MB). Since only one of these operations can be executed at a time by a database session, and an installation normally doesn't have many of them running concurrently, it's safe to set this value significantly larger than work_mem. Larger settings might improve performance for vacuuming and for restoring database dumps. Note that when autovacuum runs, up to autovacuum_max_workers times this memory may be allocated, so be careful not to set the default value too high. It may be useful to control for this by separately setting autovacuum_work_mem.
Compare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:5cd97bf67372cc49bcc77dd96fbc03d7aa042690665dde89b4015b34e5249c98
Text language: en · wiki-repair-20261023:5cd97bf67372cc49bcc77dd96fbc03d7aa042690665dde89b4015b34e5249c98