Re: Change the signature of pgstat_report_vacuum() so that it's passed a Relation

From: Andres Freund <andres(at)anarazel(dot)de>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Change the signature of pgstat_report_vacuum() so that it's passed a Relation
Date: 2025-12-16 14:55:09
Message-ID: gzz22gaiorfkmzufltyst2xma7fuxrgyf2mb6gztpeiameigza@cahhwquplhjw
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-12-16 09:45:34 +0000, Bertrand Drouvot wrote:
> On Tue, Dec 16, 2025 at 04:39:05PM +0900, Michael Paquier wrote:
> > On Tue, Dec 16, 2025 at 06:49:13AM +0000, Bertrand Drouvot wrote:
> > > While working on relfilenode statistics, Andres suggested that we pass the Relation
> > > to pgstat_report_vacuum() (instead of the parameters inherited from the Relation,
> > > (See [1])).
> > >
> > > That looks like a good idea to me as it reduces the number of parameters and it's
> > > consistent with pgstat_report_analyze().
> >
> > Fine by me.
>
> Thank you both for looking at it!
>
> I'm just thinking that we could mark the new "Relation rel" parameter as a
> const one. Indeed we are in a "report" function that only makes use of the
> Relation as read only.

-1.

> But, we can't do the same for pgstat_report_analyze() because pgstat_should_count_relation()
> can modify the relation through pgstat_assoc_relation(). So I'm inclined to
> let it as in v1. Thoughts?

I think const markings for things like this just means more code churn or ugly
casts when it inevitably ends up not working at some point.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrien Nayrat 2025-12-16 15:08:26 Re: Queries that should be canceled will get stuck on secure_write function
Previous Message Christoph Berg 2025-12-16 14:48:38 Re: failed NUMA pages inquiry status: Operation not permitted