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: Generate pg_stat_get*() functions for tables using macros
Date: Tue, 06 Dec 2022 01:54:52 +0000
Message-ID: <E1p2NAZ-002Art-Fh@gemulon.postgresql.org> (raw)

Generate pg_stat_get*() functions for tables using macros

The same code pattern is repeated 17 times for int64 counters (0 for
missing entry) and 5 times for timestamps (NULL for missing entry) on
table entries.  This code is switched to use a macro for the basic code
instead, shaving a few hundred lines of originally-duplicated code.  The
function names remain the same, but some fields of PgStat_StatTabEntry
have to be renamed to cope with the new style.

Author: Bertrand Drouvot
Reviewed-by: Nathan Bossart
Discussion: https:/postgr.es/m/20221204173207.GA2669116@nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/83a1a1b56645b7a55ec00e44f8018116ee87c720

Modified Files
--------------
src/backend/access/heap/README.HOT           |   2 +-
src/backend/postmaster/autovacuum.c          |   6 +-
src/backend/utils/activity/pgstat_relation.c |  50 +--
src/backend/utils/adt/pgstatfuncs.c          | 457 ++++++---------------------
src/include/pgstat.h                         |  20 +-
5 files changed, 139 insertions(+), 396 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1p2NAZ-002Art-Fh@gemulon.postgresql.org>
Permalink:  ../E1p2NAZ-002Art-Fh@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p2NAZ-002Art-Fh@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Generate pg_stat_get*() functions for tables using macros
  In-Reply-To: <E1p2NAZ-002Art-Fh@gemulon.postgresql.org>
  References: <E1p2NAZ-002Art-Fh@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