Re: Change the signature of pgstat_report_vacuum() so that it's passed a Relation - Mailing list pgsql-hackers

From Chao Li
Subject Re: Change the signature of pgstat_report_vacuum() so that it's passed a Relation
Date
Msg-id 7C0A6B67-7044-481E-877B-A80227696C7C@gmail.com
Whole thread Raw
In response to Re: Change the signature of pgstat_report_vacuum() so that it's passed a Relation  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers

> On Dec 16, 2025, at 17:45, Bertrand Drouvot <bertranddrouvot.pg@gmail.com> wrote:
>
> Hi,
>
> 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.
>
> 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 guess you don’t have to. I search over the code base, and cannot find a “const Ration” parameter. And actually,
Relationis typedef of “structure RelationData *”, so if you want to make it const, then you have to do “const structure
RelationData*rel”, because “const Relation rel” won’t behave as your intention. 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Change the signature of pgstat_report_vacuum() so that it's passed a Relation
Next
From: Nitin Jadhav
Date:
Subject: Re: Fix crash during recovery when redo segment is missing