Add vacuum_truncate configuration parameter.
authorNathan Bossart <nathan@postgresql.org>
Thu, 20 Mar 2025 15:16:50 +0000 (10:16 -0500)
committerNathan Bossart <nathan@postgresql.org>
Thu, 20 Mar 2025 15:16:50 +0000 (10:16 -0500)
commit0164a0f9ee12e0eff9e4c661358a272ecd65c2d4
treeadc03a29d38053e20cf598d579a8717f16b21212
parent618c64ffd3967cb5313b4b11e1e1043a074f2139
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
13 files changed:
doc/src/sgml/config.sgml
doc/src/sgml/ref/create_table.sgml
doc/src/sgml/ref/vacuum.sgml
src/backend/access/common/reloptions.c
src/backend/commands/vacuum.c
src/backend/utils/misc/guc_tables.c
src/backend/utils/misc/postgresql.conf.sample
src/include/access/reloptions.h
src/include/commands/vacuum.h
src/include/utils/guc_tables.h
src/include/utils/rel.h
src/test/regress/expected/vacuum.out
src/test/regress/sql/vacuum.sql