From: Nathan Bossart <nathandbossart@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Robert Treat <rob@xzilla.net>
Cc: satyanarlapuram@gmail.com, pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: tndrwang@gmail.com
Subject: Re: Add pg_stat_autovacuum_priority
Date: Wed, 8 Apr 2026 13:37:31 -0500
Message-ID: <adaga-DMFE2KnhXO@nathan> (raw)
In-Reply-To: <CAA5RZ0tUq7SEHvAPkYpCw7Y4XOoWLPpsfxO2ZQ5AzQRcQMMAgg@mail.gmail.com>
References: <adE9RbcA7lhH_w2d@nathan>
<CAA5RZ0tYzPDeXbqz9uKacRV2xjD055qrg=s3w2PEQPK8EruuSg@mail.gmail.com>
<adFiCgN22xJ7Z-oR@nathan>
<CAA5RZ0vRP-W2wJD2OxEb-=VGj2sp5pMCqHQg9YJiuDVPhaY5jQ@mail.gmail.com>
<adQsdvPPNviWMCXb@nathan>
<5684f479-858e-4c5d-b8f5-bcf05de1f909@gmail.com>
<3077290.1775668665@sss.pgh.pa.us>
<adaWuTR7oCKodH7k@nathan>
<adacEjlRZco26f0h@nathan>
<CAA5RZ0tUq7SEHvAPkYpCw7Y4XOoWLPpsfxO2ZQ5AzQRcQMMAgg@mail.gmail.com>
On Wed, Apr 08, 2026 at 01:28:06PM -0500, Sami Imseih wrote:
>> + if (AmAutoVacuumWorkerProcess())
>> + pfree(tabentry);
>> }
>
> This works too, but v1-0001 is more generalized and we don't have to
> care about who the caller is when deciding to free or not.
Well, I think if we were building this view from scratch without any
knowledge of autovacuum, we probably wouldnt bother manually freeing the
stats entries based on the value of the GUC. We'd probably just let the
commit/abort code take care of it, which AFAICT is what we do elsewhere.
Manually freeing the entries is also risky, which commit 02502c1bca touches
on:
Note: pfree'ing the PgStat_StatTabEntry structs here seems a bit
risky, because pgstat_fetch_stat_tabentry_ext does not guarantee
anything about whether its result is long-lived. It appears okay
so long as autovacuum forces PGSTAT_FETCH_CONSISTENCY_NONE, but
I think that API could use a re-think.
This seems very much to be an autovacuum-specific hack that we shouldn't be
propagating elsewhere.
--
nathan
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-hackers@postgresql.org
Cc: nathandbossart@gmail.com, samimseih@gmail.com, tgl@sss.pgh.pa.us, exclusion@gmail.com, bharath.rupireddyforpostgres@gmail.com, rob@xzilla.net, tndrwang@gmail.com
Subject: Re: Add pg_stat_autovacuum_priority
In-Reply-To: <adaga-DMFE2KnhXO@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