public inbox for [email protected]  
help / color / mirror / Atom feed
From: Naga Appani <[email protected]>
To: Michael Paquier <[email protected]>
Cc: Ashutosh Bapat <[email protected]>
Cc: Tomas Vondra <[email protected]>
Cc: Xuneng Zhou <[email protected]>
Cc: torikoshia <[email protected]>
Cc: Kirill Reshke <[email protected]>
Cc: [email protected]
Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring
Date: Mon, 29 Dec 2025 20:57:11 -0600
Message-ID: <CA+QeY+Bjbe8GuNYaDDHMAYJMoR9F+R7xLKWsUTjJrcxfzs_cZA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CA+QeY+Aja_=j1EuY87L06KaPO4EJqqkS4B+Vg9AsWnGM1d_VRA@mail.gmail.com>
	<CAExHW5vDJ526OXv+Hk-=TxPoiL7RR+k+xSF2tyNqtaJHC5aoDQ@mail.gmail.com>
	<CA+QeY+CF2q2M51k5t4rZZ2SNeEq8ORf3Dr8T1+jm72VsHRJfjw@mail.gmail.com>
	<CAExHW5shToKbeiw1eRGeiSyVeCYZUJyw2KUtBKYFn0J3dCGzbA@mail.gmail.com>
	<CA+QeY+CqRjUj93_kV0YmMBqfkgo4WGEoiYOaP_wCMoJ8FOKpog@mail.gmail.com>
	<[email protected]>
	<CAExHW5t-di9g+S-7pdXxCA8z3AtCWYn_=Ou9fY0aMg7K0wA2KA@mail.gmail.com>
	<CA+QeY+DO2y-3JfK68Wqerv2wmG43B7aoAhsWa7YrsKZo_ayOtg@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Sun, Dec 28, 2025 at 9:51 PM Michael Paquier <[email protected]> wrote:
> So, here is what I have in mind, split into independent pieces:
> - Remove the existing type confusion with GetMultiXactInfo(), due to
> how things have always been done in MultiXactMemberFreezeThreshold().
> - Add macro MultiXactOffsetStorageSize(), to calculate the amount of
> space used between two offsets.
> - The main patch, with adjustments in comments, the test (no
> non-ASCII characters in that, please).  One thing that was really
> surprising is that you did not consider ROLE_PG_READ_ALL_STATS.  We
> expect all the stats information to be hidden if a role is not granted
> access to them, and this function should be no exception especially as
> it relates to disk space usage like database or tablespace size
> functions.
>
> Anyway, attached are all these updated pieces.  The doc edits are what
> I have mentioned upthread, close to what you have suggested to me
> offline.
>
> Comments?
> --
> Michael

Thank you for patches, Michael! I've tested and everything works well:
- All patches apply cleanly
- Isolation test (multixact-stats) passes
- Function correctly reports stats under heavy load

Tested with significant multixact activity:
++++++++++++++++++++++++++++++++++++++++++++++
postgres=# \x
Expanded display is on.
postgres=# SELECT
    to_char(num_mxids::bigint, 'FM999,999,999,999') AS num_mxids,
    to_char(num_members::bigint, 'FM999,999,999,999') AS num_members,
    to_char(members_size::bigint, 'FM999,999,999,999') AS members_size_bytes,
    pg_size_pretty(members_size) AS members_size_pretty,
    to_char(oldest_multixact::text::bigint, 'FM999,999,999,999') AS
oldest_multixact
FROM pg_get_multixact_stats();
-[ RECORD 1 ]-------+------------------
num_mxids           | 235,095,556
num_members         | 14,435,701,862
members_size_bytes  | 72,178,509,300
members_size_pretty | 67 GB
oldest_multixact    | 2
++++++++++++++++++++++++++++++++++++++++++++++

After cleanup, the function properly resets:
++++++++++++++++++++++++++++++++++++++++++++++
-[ RECORD 1 ]-------+-------------
num_mxids           | 0
num_members         | 0
members_size_bytes  | 0
members_size_pretty | 0 bytes
oldest_multixact    | 235,095,558
++++++++++++++++++++++++++++++++++++++++++++++

The oldest_multixact correctly advances to reflect the cleanup.

Thanks for adding the pg_read_all_stats privilege check!

I think this is ready for RFC.

Best regards,
Naga





view thread (42+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring
  In-Reply-To: <CA+QeY+Bjbe8GuNYaDDHMAYJMoR9F+R7xLKWsUTjJrcxfzs_cZA@mail.gmail.com>

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

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