Re: pgstat: Flush some statistics within running transactions, take 2

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(dot)com>
Subject: Re: pgstat: Flush some statistics within running transactions, take 2
Date: 2026-09-03 05:50:34
Message-ID: apkKqjpqFYrfMrcl@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Sep 02, 2026 at 11:16:08AM -0500, Sami Imseih wrote:
> > The scan only performs one backend local bool write per pending entry, so
> > this
> > is probably negligible compared to the actual flush work. A pass generation
> > could avoid the extra scan, but I'm not sure that would be worth the
> > additional
> > complexity.
> >
> > What do you think?
>
>
> Even so, I think the pass-generation approach is the better idea here. It's
> slightly more code, but it avoids the extra full-list reset pass. I will
> feel
> better with the generational counter.

Thanks! The generation counter approach makes sense to me, it avoids the extra
reset scan.

I just have 1 minor comment related to the tests:

=== 1

+CREATE TABLE trunc_stats_test5(id serial);

I think it's related DROP is missing.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-09-03 05:51:28 Re: pg_upgrade: Test --check with a running source server
Previous Message Etsuro Fujita 2026-09-03 05:35:53 Re: Remove fcinfo from statistics update internal functions