Re: Disabling vacuum truncate for autovacuum

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Gurjeet Singh <gurjeet(at)singh(dot)im>, Robert Haas <robertmhaas(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>, Will Storey <will(at)summercat(dot)com>
Subject: Re: Disabling vacuum truncate for autovacuum
Date: 2025-03-14 15:42:07
Message-ID: Z9ROT9v4rHjDYWNX@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thu, Mar 06, 2025 at 08:54:59AM +0900, Fujii Masao wrote:
> +1 to having the reloption (if specified) override the GUC setting.
> That is, I think that autovacuum_vacuum_truncate as defining
> the default behavior for VACUUM truncation, and that the GUC should
> only apply when neither the TRUNCATE option in VACUUM nor
> the reloption is set.

One other difference in my version of the patch [0] is to call this GUC
vacuum_truncate and have it apply to both autovacuum and VACUUM. I did
this for the following reasons:

* There is no autovacuum-specific storage parameter. There is only
vacuum_truncate and toast.vacuum_truncate, both of which apply to
autovacuum and VACUUM. Unfortunately, adding autovacuum-specific storage
parameters at this point would break things for folks who are already
using vacuum_truncate to prevent autovacuum from truncating. In any
case, I gather that we try to ordinarily keep storage parameters named
the same as their corresponding GUCs.

* I'm not sure whether there's a real need to control the autovacuum
default but not the VACUUM one. I'd expect most users of this stuff to
be worried about truncation in both cases, especially for the hot standby
use-case mentioned upthread.

I should also mention that we just have a few weeks left in the v18
development cycle. The code itself seems pretty straightforward, so if we
can agree on behavior and nomenclature, I'll do my darndest to get this
responsibly committed in time.

[0] https://postgr.es/m/attachment/172951/v2-0001-Add-vacuum_truncate-GUC.patch

--
nathan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2025-03-14 21:01:09 Re: Disabling vacuum truncate for autovacuum
Previous Message Greg Sabino Mullane 2025-03-14 14:00:31 Re: Query optimization

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2025-03-14 16:58:55 PG_CFLAGS rpath Passthrough Issue
Previous Message Christoph Berg 2025-03-14 15:39:55 Re: Available disk space per tablespace