pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor some code related to transaction-level statistics for r
Date: Sun, 29 Oct 2023 23:23:53 +0000
Message-ID: <E1qxF8K-00315l-Ix@gemulon.postgresql.org> (raw)

Refactor some code related to transaction-level statistics for relations

This commit refactors find_tabstat_entry() so as transaction counters
for inserted, updated and deleted tuples are included in the result
returned.   If a shared entry is found for a relation, its result is now
a copy of the PgStat_TableStatus entry retrieved from shared memory.
This idea has been proposed by Andres Freund.

While on it, the following SQL functions, used in system views, are
refactored with macros, in the same spirit as 83a1a1b56645, reducing the
amount of code:
- pg_stat_get_xact_tuples_deleted()
- pg_stat_get_xact_tuples_inserted()
- pg_stat_get_xact_tuples_updated()

There is now only one caller of find_tabstat_entry() in the tree.

Author: Bertrand Drouvot
Discussion: https://postgr.es/m/b9e1f543-ee93-8168-d530-d961708ad9d3@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bf01e1ba963aed17449c70fed03c4ae74cce3926

Modified Files
--------------
src/backend/utils/activity/pgstat_relation.c | 40 +++++++++++++++--
src/backend/utils/adt/pgstatfuncs.c          | 66 +++-------------------------
2 files changed, 42 insertions(+), 64 deletions(-)



Message-ID: <E1qxF8K-00315l-Ix@gemulon.postgresql.org>
Permalink:  ../E1qxF8K-00315l-Ix@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qxF8K-00315l-Ix@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor some code related to transaction-level statistics for r
  In-Reply-To: <E1qxF8K-00315l-Ix@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox