diff options
author | Nathan Bossart <nathan@postgresql.org> | 2025-03-20 10:16:50 -0500 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2025-03-20 10:16:50 -0500 |
commit | 0164a0f9ee12e0eff9e4c661358a272ecd65c2d4 (patch) | |
tree | adc03a29d38053e20cf598d579a8717f16b21212 /src/backend/utils/misc/guc_tables.c | |
parent | 618c64ffd3967cb5313b4b11e1e1043a074f2139 (diff) | |
download | postgresql-0164a0f9ee12e0eff9e4c661358a272ecd65c2d4.tar.gz postgresql-0164a0f9ee12e0eff9e4c661358a272ecd65c2d4.zip |
Add vacuum_truncate configuration parameter.
This new parameter works just like the storage parameter of the
same name: if set to true (which is the default), autovacuum and
VACUUM attempt to truncate any empty pages at the end of the table.
It is primarily intended to help users avoid locking issues on hot
standbys. The setting can be overridden with the storage parameter
or VACUUM's TRUNCATE option.
Since there's presently no way to determine whether a Boolean
storage parameter is explicitly set or has just picked up the
default value, this commit also introduces an isset_offset member
to relopt_parse_elt.
Suggested-by: Will Storey <will@summercat.com>
Author: Nathan Bossart <nathandbossart@gmail.com>
Co-authored-by: Gurjeet Singh <gurjeet@singh.im>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Robert Treat <rob@xzilla.net>
Discussion: https://postgr.es/m/Z2DE4lDX4tHqNGZt%40dev.null
Diffstat (limited to 'src/backend/utils/misc/guc_tables.c')
-rw-r--r-- | src/backend/utils/misc/guc_tables.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index cc8f2b1230a..97cfd6e5a82 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -712,6 +712,7 @@ const char *const config_group_names[] = [STATS_CUMULATIVE] = gettext_noop("Statistics / Cumulative Query and Index Statistics"), [VACUUM_AUTOVACUUM] = gettext_noop("Vacuuming / Automatic Vacuuming"), [VACUUM_COST_DELAY] = gettext_noop("Vacuuming / Cost-Based Vacuum Delay"), + [VACUUM_DEFAULT] = gettext_noop("Vacuuming / Default Behavior"), [VACUUM_FREEZING] = gettext_noop("Vacuuming / Freezing"), [CLIENT_CONN_STATEMENT] = gettext_noop("Client Connection Defaults / Statement Behavior"), [CLIENT_CONN_LOCALE] = gettext_noop("Client Connection Defaults / Locale and Formatting"), @@ -2131,6 +2132,15 @@ struct config_bool ConfigureNamesBool[] = NULL, NULL, NULL }, + { + {"vacuum_truncate", PGC_USERSET, VACUUM_DEFAULT, + gettext_noop("Enables vacuum to truncate empty pages at the end of the table."), + }, + &vacuum_truncate, + true, + NULL, NULL, NULL + }, + /* End-of-list marker */ { {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL, NULL |