pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Robert Treat <rob@xzilla.net>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Gurjeet Singh <gurjeet@singh.im>
Cc: Andres Freund <andres@anarazel.de>
Cc: Will Storey <will@summercat.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Postgres Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Disabling vacuum truncate for autovacuum
Date: Thu, 20 Mar 2025 13:13:02 -0500
Message-ID: <Z9xaroJSrS44HyKG@nathan> (raw)
In-Reply-To: <CAKFQuwYKtEUYKS+18gRs-xPhn0qOJgM2KGyyWVCODHuVn9F-XQ@mail.gmail.com>
References: <CABwTF4WFp-oNSm6utik6g-1HZBxijTJBcuX7BKD8MYqza+KMnw@mail.gmail.com>
	<6f2f2167f4be09e6ca9251c8f69dfe01809d68be.camel@cybertec.at>
	<CABV9wwNagobmRMCxs0dKqWmKXaQTUQj+oOOTw=fsPAgbBfVhew@mail.gmail.com>
	<Z9g8a4HGLUcSo96v@nathan>
	<Z9ohFZtDaZnkch7u@nathan>
	<88e3b55a-8ef8-4b53-8d71-6bfde1a07bc1@oss.nttdata.com>
	<Z9rlb0jgNLm8ULAB@nathan>
	<Z9rsMX5ZOL5E0cQy@nathan>
	<Z9wxuP1AY303wAxM@nathan>
	<CAKFQuwYKtEUYKS+18gRs-xPhn0qOJgM2KGyyWVCODHuVn9F-XQ@mail.gmail.com>

On Thu, Mar 20, 2025 at 09:59:45AM -0700, David G. Johnston wrote:
> I get the need for this kind of logic, since we used a boolean for the
> table option, but as a self-proclaimed hack it seems worth more comments
> than provided here.  Especially pertaining to whether this is indeed
> generic or vacuum_truncate specific.  It's unclear since both isset and
> vacuum_truncate_set have been introduced.

I'm happy to expand the comments, but...

> If it is now a general property
> applying to any setting then vacuum_truncate_set shouldn't be needed - we
> should just get the isset value of the existing vacuum_truncate reloption
> by name.

the reason I added this field is because I couldn't find any existing way
to get this information where it's needed.  So, I followed the existing
pattern of adding an offset to something we can access.  This can be used
for any reloption, but currently vacuum_truncate is the only one that does.

How does something like this look for the comment?

	/*
	 * isset_offset is an optional offset of a field in the result struct
	 * that stores whether the value is explicitly set for the relation or
	 * has just picked up the default value.  In most cases, this can be
	 * deduced by giving the reloption a special default value (e.g., -2 is
	 * a common one for integer reloptions), but this isn't always
	 * possible.  One notable example is Boolean reloptions, where it's
	 * difficult to discern the source of the value.  This offset is only
	 * used if given a value greater than zero.
	 */
	int			isset_offset;

-- 
nathan





view thread (34+ messages)  latest in thread

Message-ID: <Z9xaroJSrS44HyKG@nathan>
Permalink:  ../Z9xaroJSrS44HyKG@nathan/
Also on:    postgresql.org/message-id/Z9xaroJSrS44HyKG@nathan

 · 

reply

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-general@postgresql.org
  Cc: nathandbossart@gmail.com, david.g.johnston@gmail.com, masao.fujii@oss.nttdata.com, rob@xzilla.net, laurenz.albe@cybertec.at, gurjeet@singh.im, andres@anarazel.de, will@summercat.com, robertmhaas@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: Disabling vacuum truncate for autovacuum
  In-Reply-To: <Z9xaroJSrS44HyKG@nathan>

* 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