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-11-17 07:38:25
Message-ID: avwEcRxMmL7o/hfm@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Nov 16, 2026 at 10:56:09AM -0600, Sami Imseih wrote:
> Attached is v20 which addresses the points raised by
> both Zsolt and Bertrand above.

Thanks!

> 2/ n_ins_since_vacuum after TRUNCATE plus an aborted savepoint is
> fixed. I added a test for this.

It looks like that it now makes the reverse order produce the wrong result, for
example:

"
BEGIN;
SAVEPOINT s;
INSERT INTO t SELECT generate_series(1, 5);
ROLLBACK TO SAVEPOINT s;

SELECT pg_stat_force_next_flush();

TRUNCATE t;
COMMIT;

SELECT pg_stat_force_next_flush();
"

produces 5 for n_ins_since_vacuum, while 0 is expected.

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 Zhijie Hou 2026-11-17 07:42:58 Re: Document prepared transaction lock waits with two_phase subscriptions
Previous Message Stepan Neretin 2026-11-17 07:30:10 Re: FATAL: could not send end-of-streaming message to primary: no COPY in progress