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: Add pg_get_multixact_stats()
Date: Tue, 30 Dec 2025 06:40:46 +0000
Message-ID: <E1vaTPR-003RYz-1b@gemulon.postgresql.org> (raw)

Add pg_get_multixact_stats()

This new function exposes at SQL level some information related to
multixacts, not available until now.  This data is useful for monitoring
purposes, especially for workloads that make a heavy use of multixacts:
- num_mxids, number of MultiXact IDs in use.
- num_members, number of member entries in use.
- members_size, bytes used by num_members in pg_multixact/members/.
- oldest_multixact: oldest MultiXact still needed.

This patch has been originally proposed when MultiXactOffset was still
32 bits, to monitor wraparound.  This part is not relevant anymore since
bd8d9c9bdfa0 that has widen MultiXactOffset to 64 bits.  The monitoring
of disk space usage for the members is still relevant.

Some tests are added to check this function, in the shape of one
isolation test with concurrent transactions that take a ROW SHARE lock,
and some SQL tests for pg_read_all_stats.  Some documentation is added
to explain some patterns that can come from the information provided by
the function.

Bump catalog version.

Author: Naga Appani <nagnrik@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Discussion: https://postgr.es/m/CA+QeY+AAsYK6WvBW4qYzHz4bahHycDAY_q5ECmHkEV_eB9ckzg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/97b101776ce23dd6c4abbdae213806bc24ed6133

Modified Files
--------------
doc/src/sgml/func/func-info.sgml                |  33 +++++++
doc/src/sgml/maintenance.sgml                   |  39 +++++++--
src/backend/utils/adt/multixactfuncs.c          |  53 +++++++++++
src/include/catalog/catversion.h                |   2 +-
src/include/catalog/pg_proc.dat                 |   7 ++
src/test/isolation/expected/multixact-stats.out |  89 +++++++++++++++++++
src/test/isolation/isolation_schedule           |   1 +
src/test/isolation/specs/multixact-stats.spec   | 111 ++++++++++++++++++++++++
src/test/regress/expected/misc_functions.out    |  29 +++++++
src/test/regress/sql/misc_functions.sql         |  15 ++++
10 files changed, 373 insertions(+), 6 deletions(-)



Message-ID: <E1vaTPR-003RYz-1b@gemulon.postgresql.org>
Permalink:  ../E1vaTPR-003RYz-1b@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vaTPR-003RYz-1b@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: Add pg_get_multixact_stats()
  In-Reply-To: <E1vaTPR-003RYz-1b@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