Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bbf668d

Browse files
committed
Lower minimum maintenance_work_mem to 64kB
Since the introduction of TID store, vacuum uses far less memory in the common case than in versions 16 and earlier. Invoking multiple rounds of index vacuuming in turn requires a much larger table. It'd be a good idea anyway to cover this case in regression testing, and a lower limit is less painful for slow buildfarm animals. The reason to do it now is to re-enable coverage of the bugfix in commit 83c39a1. For consistency, give autovacuum_work_mem the same treatment. Suggested by Andres Freund Tested by Melanie Plageman Backpatch to v17, where TID store was introduced Discussion: https://postgr.es/m/20240516205458.ohvlzis5b5tvejru@awork3.anarazel.de Discussion: https://postgr.es/m/20240722164745.fvaoh6g6zprisqgp%40awork3.anarazel.de
1 parent f5a1311 commit bbf668d

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/backend/postmaster/autovacuum.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3339,12 +3339,12 @@ check_autovacuum_work_mem(int *newval, void **extra, GucSource source)
33393339
return true;
33403340

33413341
/*
3342-
* We clamp manually-set values to at least 1MB. Since
3342+
* We clamp manually-set values to at least 64kB. Since
33433343
* maintenance_work_mem is always set to at least this value, do the same
33443344
* here.
33453345
*/
3346-
if (*newval < 1024)
3347-
*newval = 1024;
3346+
if (*newval < 64)
3347+
*newval = 64;
33483348

33493349
return true;
33503350
}

src/backend/utils/misc/guc_tables.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -2510,14 +2510,19 @@ struct config_int ConfigureNamesInt[] =
25102510
NULL, NULL, NULL
25112511
},
25122512

2513+
/*
2514+
* Dynamic shared memory has a higher overhead than local memory contexts,
2515+
* so when testing low-memory scenarios that could use shared memory, the
2516+
* recommended minimum is 1MB.
2517+
*/
25132518
{
25142519
{"maintenance_work_mem", PGC_USERSET, RESOURCES_MEM,
25152520
gettext_noop("Sets the maximum memory to be used for maintenance operations."),
25162521
gettext_noop("This includes operations such as VACUUM and CREATE INDEX."),
25172522
GUC_UNIT_KB
25182523
},
25192524
&maintenance_work_mem,
2520-
65536, 1024, MAX_KILOBYTES,
2525+
65536, 64, MAX_KILOBYTES,
25212526
NULL, NULL, NULL
25222527
},
25232528

src/backend/utils/misc/postgresql.conf.sample

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@
139139
# you actively intend to use prepared transactions.
140140
#work_mem = 4MB # min 64kB
141141
#hash_mem_multiplier = 2.0 # 1-1000.0 multiplier on hash table work_mem
142-
#maintenance_work_mem = 64MB # min 1MB
143-
#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
142+
#maintenance_work_mem = 64MB # min 64kB
143+
#autovacuum_work_mem = -1 # min 64kB, or -1 to use maintenance_work_mem
144144
#logical_decoding_work_mem = 64MB # min 64kB
145145
#max_stack_depth = 2MB # min 100kB
146146
#shared_memory_type = mmap # the default is the first option

0 commit comments

Comments
 (0)