Re: Custom pgstat support performance regression for simple queries - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Custom pgstat support performance regression for simple queries
Date
Msg-id aIC4ORzkuH/BMn21@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Custom pgstat support performance regression for simple queries  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Custom pgstat support performance regression for simple queries
List pgsql-hackers
On Wed, Jul 23, 2025 at 05:09:54PM +0900, Michael Paquier wrote:
> On Jul 23, 2025, at 16:33, Bertrand Drouvot <bertranddrouvot.pg@gmail.com> wrote:
> > Maybe we could use a flag, say:
> > 
> > #define PGSTAT_PENDING_IO     (1 << 0)
> > #define PGSTAT_PENDING_WAL    (1 << 1)
> > #define PGSTAT_PENDING_SLRU   (1 << 2)
> > 
> > and check for a pgstat_pending_mask in pgstat_report_stat() instead?
> > 
> > They would need to set pgstat_pending_mask accordingly when they flush, have
> > pending stats though.
> 
> The point is just to say to the report path to move further if at least one of
> the fixed stats kinds has something to flush, then let the loop do its work
> across all the stats kinds if they have a flush callback,

Right.

> so we don’t really need to mix multiple numbers; we could just have a single
> boolean flag that any fixed-sized stats kinds can set to let the reporting know
> that some activity has happened.

That works to say "there are pending stats" but not well to say "there are no
pending stats".

Indeed, with a single boolean flag, then how could a stat say that it has nothing
pending anymore (when flushing) without saying "all the stats have nothing
pending" (while some may still have pending stats)?

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: index prefetching
Next
From: Etsuro Fujita
Date:
Subject: Re: [(known) BUG] DELETE/UPDATE more than one row in partitioned foreign table