Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring - Mailing list pgsql-hackers
From | Ashutosh Bapat |
---|---|
Subject | Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring |
Date | |
Msg-id | CAExHW5sFtNduYEnyGhQOb=xiLrbkvwE0merhpZA5pNqcNzBbmw@mail.gmail.com Whole thread Raw |
In response to | Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring (Naga Appani <nagnrik@gmail.com>) |
List | pgsql-hackers |
On Fri, Sep 12, 2025 at 9:03 AM Naga Appani <nagnrik@gmail.com> wrote: > + </para> + <para> + Returns statistics about current multixact usage: + <literal>num_mxids</literal> is the total number of multixact IDs assigned since startup, + <literal>num_members</literal> is the total number of multixact member entries created since startup, GetMultiXactInfo() returns following *members = nextOffset - *oldestOffset; *multixacts = nextMultiXactId - *oldestMultiXactId; They seem to be the numbers that exist in the system at the time of the call and not since the startup. Am I missing something? + up to approximately 2^32 entries(occupying roughly 20GB in the space between s and ( + proallargtypes => '{int4,int8,int8,xid,int8}', I think the first parameter should also be int8 since uint32 won't fit into int4. > > > + See <xref linkend="vacuum-for-multixact-wraparound"/> for further > > details on multixact wraparound. > > > > I don't think we need this reference here. Reference back from that > > section is enough. > I kept the cross-reference for now since other multixact function docs > (such as pg_get_multixact_members()) already use this style, and it helps > readers who land directly on the function reference page. Please let me > know if you would prefer that I remove it. None of the write up there talks about multixact wraparound so the reference seems arbitrary to me. I would remove it. > > > + * Returns NULL if the oldest referenced offset is unknown, which > > happens during > > + * system startup or when no MultiXact references exist in any relation. > > > > If no MultiXact references exist, and GetMultiXactInfo() returns > > false, MultiXactMemberFreezeThreshold() will assume the worst, which I > > take as meaning that it will trigger aggressive autovacuum. No > > MultiXact references existing is a common case which shouldn't be > > assumed as the worst case. The comment I quoted means "the oldest > > value of the offset referenced by any multi-xact referenced by a > > relation *may not be always known". You seem to have interpreted "may > > not be known" as "does not exist" That's not right. I would write this > > as "Returns NULL if the oldest referenced offset is unknown which > > happens during system startup". > > > > Similarly I would rephrase the following docs as > > + <para> > > + The function returns <literal>NULL</literal> when multixact > > statistics are unavailable. > > + For example, during startup before multixact initialization completes or when > > + the oldest member offset cannot be determined. > > > > "The function returns <literal>NULL</literal> when multixact > > statistics when the oldest multixact offset corresponding to a > > multixact referenced by a relation is not known after starting the > > system." > > > Updated. Thanks for updating the documentation. But the comment in prologue of pg_get_multixact_stats is not completely correct as mentioned in my previous reply. I would just say "Returns NULL if the oldest referenced offset is unknown". Anybody who wants to know when can that happen, may search relevant code by looking at GetMultiXactInfo(). I still find the comment at the start of the isolation test a bit verbose. But I think it's best to leave that to a committer's judgement. However, the word "locker" is unusual. You want to say the session that locks a row (or something similar). We may leave exact words to a committer's judgement. I still find think that the specific usage scenarios described in the documentation are not required. And the computation in pg_get_multixact_stats() should use macros instead of bare numbers. But we can leave that for a committer to decide. Once you address above comments, we may mark the CF entry as RFC. -- Best Wishes, Ashutosh Bapat
pgsql-hackers by date: