Re: problems with toast.* reloptions

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Greg Burd <greg(at)burd(dot)me>, solai v <solai(dot)cdac(at)gmail(dot)com>, Nikita Malakhov <hukutoc(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: problems with toast.* reloptions
Date: 2026-08-11 14:53:53
Message-ID: CAA5RZ0urkERUBgbRi1AWiDJdXWo3yp=-5iO6bZ8d6Svp+XhZRQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I looked these patches while looking at potential cases for injection point
conditional strings [0], which could allow for better autovacuum testing,
particularly for the case being discussed here.

As far as the patches go, No comments on 0001-0004, just two nits on 0005.

1/ Instead of setting toast_vacuum_params.* inside each branch, it reads
cleaner to set toast_vacuum_params.* after params.* is done, and this
way you only set toast_vacuum_params.*once. For example, in
index_cleanup:

@@ -2223,15 +2223,12 @@ vacuum_rel(Oid relid, RangeVar *relation,
VacuumParams params,
case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
params.index_cleanup = VACOPTVALUE_ENABLED;
- toast_vacuum_params.main_index_cleanup = VACOPTVALUE_ENABLED;
break;
...
}
+
+ /* A TOAST table inherits the main relation's value. */
+ toast_vacuum_params.main_index_cleanup = params.index_cleanup;
}

The same applies to main_max_eager_freeze_failure_rate and main_truncate.

2/ A couple of comment tweaks in merge_autovac_opts()

```
@@ -3791,8 +3791,11 @@ pg_stat_get_autovacuum_scores(PG_FUNCTION_ARGS)
* The arrays below cover only the options that can be set on a TOAST table,
* grouped by the value that means "unset". Both of those facts come from
* reloptions.c, so they must be kept in sync with the entries here.
+ * Analyze options are intentionally excluded because TOAST tables are never
+ * analyzed, and autovacuum_parallel_workers is excluded because it can't be
+ * set on a TOAST table.
*
- * NB: This function destructively modifies toast_opts!
+ * NB: This modifies toast_opts in place.
*/
static StdRdOptions *
merge_autovac_opts(StdRdOptions *toast_opts, StdRdOptions *main_opts)
@@ -3821,7 +3824,7 @@ merge_autovac_opts(StdRdOptions *toast_opts,
StdRdOptions *main_opts)
offsetof(AutoVacOpts, log_vacuum_min_duration),
};

- /* float fields */
+ /* float fields whose unset sentinel is -1.0 */
static const int float_offsets[] = {
offsetof(AutoVacOpts, vacuum_cost_delay),
offsetof(AutoVacOpts, vacuum_scale_factor),
```

[0] https://www.postgresql.org/message-id/CAA5RZ0sfRTST8RQaoVXfEnVRchRtAP_YhFFUVcm6dC6v1TAChw%40mail.gmail.com

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-08-11 14:56:16 Re: pg_control_checkpoint(): add "data_checksum_version" (Pg19)?
Previous Message Maxime Schoemans 2026-08-11 14:50:43 Re: Multi-Entry Indexing for GiST & SP-GiST