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

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

Hi,

On Tue, Aug 18, 2026 at 01:01:25PM -0500, Sami Imseih wrote:
>
> I think we should keep a single struct but split it into two contiguous
> regions, non-transactional first and transactional after, with comments
> marking the boundary, and use an offset to compare each group on its own.

FWIW, I'd vote for an helper comparing the five counters that can be flushed
immediately. There are only five, and adding another one would already require
updating the merge and baseline logic.

That would keep the policy local to pgstat_relation_flush_cb() and avoid making
PgStat_TableCounts field order part of the flush logic.

That said, let's see what Michael thinks.

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-08-19 02:55:52 Re: First draft of PG 19 release notes
Previous Message Michael Paquier 2026-08-19 02:36:15 Re: pg_stat_database.checksum_failures misses single-page failures in backups