Re: Adding per backend commit and rollback counters

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding per backend commit and rollback counters
Date: 2025-08-28 16:07:40
Message-ID: aLB+zGDBofLDxx9o@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sun, Aug 10, 2025 at 07:47:09AM +0000, Bertrand Drouvot wrote:
> To sum up, v3 contains:
>
> 0001 -
> Adding per backend commit and rollback counters
> 0002 -
> Adding XID generation count per backend
> 0003 -
> Adding the pg_stat_backend view

Following recent conversations in [1], those changes have been made in v4
attached:

- avoid tracking the commit and rollback counters twice (for databases and for
backends) but increment the backend stats when the database ones are flushed. Same
idea as [2].

- pg_stat_backend is too generic (see [3]), let's use pg_stat_backend_transaction
instead. I deliberately did not use pg_stat_backend_xact to not confuse with the
other "*xact*" functions/views where the meaning is not the same. I'm open to
other naming suggestion though.

[1]: https://www.postgresql.org/message-id/flat/aJrxug4LCg4Hm5Mm%40ip-10-97-1-34.eu-west-3.compute.internal
[2]: https://www.postgresql.org/message-id/7fhpds4xqk6bnudzmzkqi33pinsxammpljwde5gfkjdygvejrj%40ojkzfr7dxkmm
[3]: https://www.postgresql.org/message-id/aK8OuVPmmDTc9CFX%40ip-10-97-1-34.eu-west-3.compute.internal

Regards,

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

Attachment Content-Type Size
v4-0001-Adding-per-backend-commit-and-rollback-counters.patch text/x-diff 5.8 KB
v4-0002-Adding-XID-generation-count-per-backend.patch text/x-diff 2.7 KB
v4-0003-Adding-the-pg_stat_backend_transaction-view.patch text/x-diff 13.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-08-28 16:08:50 Re: index prefetching
Previous Message Bertrand Drouvot 2025-08-28 16:05:12 Re: Per backend relation statistics tracking