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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-12-16T07:39:05Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Change pgstat_report_vacuum() to use Relation

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.  I can get behind the symmetry argument with
pgstat_report_analyze() for pgstat_report_vacuum().  Another
appoealing argument with this change is that it forces the callers of
pgstat_report_vacuum() to open a relation, enforcing the policy that
we need a lock of them before reporting stats.  I don't think that we
will ever have dozens of callers of pgstat_report_vacuum() in the
tree, but it makes the API contract cleaner IMO with a long-term
picture in mind.
--
Michael