summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorNathan Bossart2025-03-20 15:16:50 +0000
committerNathan Bossart2025-03-20 15:16:50 +0000
commit0164a0f9ee12e0eff9e4c661358a272ecd65c2d4 (patch)
treeadc03a29d38053e20cf598d579a8717f16b21212 /src/include
parent618c64ffd3967cb5313b4b11e1e1043a074f2139 (diff)
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 <[email protected]> Author: Nathan Bossart <[email protected]> Co-authored-by: Gurjeet Singh <[email protected]> Reviewed-by: Laurenz Albe <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Reviewed-by: Robert Treat <[email protected]> Discussion: https://postgr.es/m/Z2DE4lDX4tHqNGZt%40dev.null
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/reloptions.h1
-rw-r--r--src/include/commands/vacuum.h1
-rw-r--r--src/include/utils/guc_tables.h1
-rw-r--r--src/include/utils/rel.h1
4 files changed, 4 insertions, 0 deletions
diff --git a/src/include/access/reloptions.h b/src/include/access/reloptions.h
index 43445cdcc6c..146aed47c2d 100644
--- a/src/include/access/reloptions.h
+++ b/src/include/access/reloptions.h
@@ -152,6 +152,7 @@ typedef struct
const char *optname; /* option's name */
relopt_type opttype; /* option's datatype */
int offset; /* offset of field in result struct */
+ int isset_offset; /* if > 0, offset of "is set" field */
} relopt_parse_elt;
/* Local reloption definition */
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index baacc63f590..bc37a80dc74 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -304,6 +304,7 @@ extern PGDLLIMPORT int vacuum_multixact_freeze_table_age;
extern PGDLLIMPORT int vacuum_failsafe_age;
extern PGDLLIMPORT int vacuum_multixact_failsafe_age;
extern PGDLLIMPORT bool track_cost_delay_timing;
+extern PGDLLIMPORT bool vacuum_truncate;
/*
* Relevant for vacuums implementing eager scanning. Normal vacuums may
diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h
index ab47145ec36..f72ce944d7f 100644
--- a/src/include/utils/guc_tables.h
+++ b/src/include/utils/guc_tables.h
@@ -89,6 +89,7 @@ enum config_group
STATS_CUMULATIVE,
VACUUM_AUTOVACUUM,
VACUUM_COST_DELAY,
+ VACUUM_DEFAULT,
VACUUM_FREEZING,
CLIENT_CONN_STATEMENT,
CLIENT_CONN_LOCALE,
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index db3e504c3d2..d94fddd7cef 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -344,6 +344,7 @@ typedef struct StdRdOptions
int parallel_workers; /* max number of parallel workers */
StdRdOptIndexCleanup vacuum_index_cleanup; /* controls index vacuuming */
bool vacuum_truncate; /* enables vacuum to truncate a relation */
+ bool vacuum_truncate_set; /* whether vacuum_truncate is set */
/*
* Fraction of pages in a relation that vacuum can eagerly scan and fail