pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: Sami Imseih <samimseih@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, 08 Apr 2026 15:21:38 -0400
Message-ID: <3101163.1775676098@sss.pgh.pa.us> (raw)
In-Reply-To: <adan_E0o69p81lIj@nathan>
References: <CAA5RZ0vxby2osMMaCuZ=680tmt583cF9n4rOzTGdsiS-1PJknA@mail.gmail.com>
	<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>
	<3097984.1775674400@sss.pgh.pa.us>
	<adan_E0o69p81lIj@nathan>

Nathan Bossart <nathandbossart@gmail.com> writes:
> On Wed, Apr 08, 2026 at 02:53:20PM -0400, Tom Lane wrote:
>> ... Aside from this problem, the elog's that
>> relation_needs_vacanalyze emits seem 100% inappropriate and misleading
>> when it's being called from the view.

> FWIW that elog() shouldn't be emitting anything from the view, unless
> something is broken.

[ looks again... ]  Oh, you mean because pg_stat_get_autovacuum_scores
passes 0 for elevel instead of any of the valid elevel constants.
Can you say "undocumented cowboy hack"?  I'd be happier if we added
something like "#define LOG_NEVER 0  /* Never emit this message */"
to elog.h and used that.

>> 2. Add a "bool *should_free" parameter, like we have in tuplestores
>> and some other places.  It's on the caller to pfree if should_free
>> gets set, but since we'd have to touch every caller, we'd not miss
>> any.

> This sounds most similar to the "bool *may_free" idea that Andres just
> posted.  IIUC the idea is that callers can free the result if they want,
> but they aren't required to do so.

Hmm, yeah I suppose a caller that doesn't care about leakage could
skip the pfree.  But are there really any of those?  The complaint
that prompted 02502c1bc concerned databases with many many thousands
of relations.

I now realize that what you said upthread about caching the results
might be a bigger problem, ie if the pgstats code does retain all
these values then we'd have a memory bloat problem there.  Maybe
we need a more aggressive API change that includes a way to specify
"don't cache this result".

			regards, tom lane





view thread (61+ messages)  latest in thread

Message-ID: <3101163.1775676098@sss.pgh.pa.us>
Permalink:  ../3101163.1775676098@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3101163.1775676098@sss.pgh.pa.us

 · 

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, exclusion@gmail.com, samimseih@gmail.com, bharath.rupireddyforpostgres@gmail.com, rob@xzilla.net, tndrwang@gmail.com
  Subject: Re: Add pg_stat_autovacuum_priority
  In-Reply-To: <3101163.1775676098@sss.pgh.pa.us>

* 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