diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2013-12-12 11:42:39 +0000 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2013-12-12 11:42:39 +0000 |
commit | 8693559cacf1765697c32fc38574af3c19ce61c1 (patch) | |
tree | 98f76e989b7539a0080d974f448f453ed3ec1b4d /src/backend/utils/misc | |
parent | 36da3cfb457b77a55582f68208d815f11ac1399e (diff) | |
download | postgresql-8693559cacf1765697c32fc38574af3c19ce61c1.tar.gz postgresql-8693559cacf1765697c32fc38574af3c19ce61c1.zip |
New autovacuum_work_mem parameter
If autovacuum_work_mem is set, autovacuum workers now use
this parameter in preference to maintenance_work_mem.
Peter Geoghegan
Diffstat (limited to 'src/backend/utils/misc')
-rw-r--r-- | src/backend/utils/misc/guc.c | 35 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index f3bf6e0aa2f..e69e132f056 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -194,6 +194,7 @@ static const char *show_tcp_keepalives_count(void); static bool check_maxconnections(int *newval, void **extra, GucSource source); static bool check_max_worker_processes(int *newval, void **extra, GucSource source); static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source); +static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source); static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source); static void assign_effective_io_concurrency(int newval, void *extra); static void assign_pgstat_temp_directory(const char *newval, void *extra); @@ -2358,6 +2359,17 @@ static struct config_int ConfigureNamesInt[] = }, { + {"autovacuum_work_mem", PGC_SIGHUP, RESOURCES_MEM, + gettext_noop("Sets the maximum memory to be used by each autovacuum worker process."), + NULL, + GUC_UNIT_KB + }, + &autovacuum_work_mem, + -1, -1, MAX_KILOBYTES, + check_autovacuum_work_mem, NULL, NULL + }, + + { {"tcp_keepalives_idle", PGC_USERSET, CLIENT_CONN_OTHER, gettext_noop("Time between issuing TCP keepalives."), gettext_noop("A value of 0 uses the system default."), @@ -8778,6 +8790,29 @@ check_autovacuum_max_workers(int *newval, void **extra, GucSource source) } static bool +check_autovacuum_work_mem(int *newval, void **extra, GucSource source) +{ + /* + * -1 indicates fallback. + * + * If we haven't yet changed the boot_val default of -1, just let it be. + * Autovacuum will look to maintenance_work_mem instead. + */ + if (*newval == -1) + return true; + + /* + * We clamp manually-set values to at least 1MB. Since + * maintenance_work_mem is always set to at least this value, do the same + * here. + */ + if (*newval < 1024) + *newval = 1024; + + return true; +} + +static bool check_max_worker_processes(int *newval, void **extra, GucSource source) { if (MaxConnections + autovacuum_max_workers + 1 + *newval > MAX_BACKENDS) diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 6096fe44457..f8bdce34d33 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -124,6 +124,7 @@ # actively intend to use prepared transactions. #work_mem = 1MB # min 64kB #maintenance_work_mem = 16MB # min 1MB +#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem #max_stack_depth = 2MB # min 100kB #dynamic_shared_memory_type = posix # the default is the first option # supported by the operating system: |