From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix VACUUM's handling of TOAST storage parameters.
Date: Mon, 24 Aug 2026 21:28:43 +0000
Message-ID: <E1wycDi-00000001xN4-0pVX@gemulon.postgresql.org> (raw)
Fix VACUUM's handling of TOAST storage parameters.
Per the documentation for CREATE TABLE:
If a table parameter value is set and the equivalent toast.
parameter is not, the TOAST table will use the table's
parameter value.
Presently, VACUUM does no such thing. It reads the TOAST table's
own reloptions, which hold only what was set through toast.*, so
vacuum_index_cleanup, vacuum_max_eager_freeze_failure_rate, and
vacuum_truncate settings on the main table have no effect on its
TOAST table.
To fix, add merge_toast_reloptions(), which walks the parse table
for StdRdOptions and takes the main table's value for anything the
TOAST table left at its default. vacuum_rel() hands the main
table's parameters down when recursing to a TOAST table, and it
merges them into a copy of the TOAST table's parameters before the
values are used. This doesn't help VACUUM against a TOAST table
directly (e.g., "VACUUM pg_toast.pg_toast_5432"), but that's
probably okay because it's not the main supported way to vacuum a
TOAST table (see VACUUM's PROCESS_MAIN and PROCESS_TOAST options).
A follow-up commit will do the same for autovacuum. While this is
a bug fix, it's too intrusive for back-patching, but the issue
seems to have gone unnoticed for a very long time, anyway.
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Greg Burd <greg@burd.me>
Tested-by: solai v <solai.cdac@gmail.com>
Discussion: https://postgr.es/m/aFRxC1W_kZU9OjJ9%40nathan
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c244c62d8b9e7762be3d35090463c76042ab7f89
Modified Files
--------------
src/backend/access/common/reloptions.c | 104 +++++++++++++++++++++
src/backend/commands/vacuum.c | 41 +++++---
src/backend/postmaster/autovacuum.c | 1 +
src/include/access/reloptions.h | 2 +
src/include/commands/vacuum.h | 8 ++
.../modules/injection_points/expected/vacuum.out | 11 +++
src/test/modules/injection_points/sql/vacuum.sql | 8 ++
7 files changed, 164 insertions(+), 11 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix VACUUM's handling of TOAST storage parameters.
In-Reply-To: <E1wycDi-00000001xN4-0pVX@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox