Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1upHBy-0029GW-6P for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Aug 2025 02:07:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1upHBw-002bOT-Th for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Aug 2025 02:07:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1upHBw-002bOK-G5 for pgsql-hackers@lists.postgresql.org; Fri, 22 Aug 2025 02:07:45 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1upHBt-001748-1S for pgsql-hackers@postgresql.org; Fri, 22 Aug 2025 02:07:44 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id D611461C28; Fri, 22 Aug 2025 11:07:37 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Fri, 22 Aug 2025 11:07:37 +0900 From: torikoshia To: Naga Appani Cc: Michael Paquier , Ashutosh Bapat , Kirill Reshke , pgsql-hackers@postgresql.org Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: torikoshia@oss.nttdata.com Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-08-22 09:28, torikoshia wrote: > On 2025-08-20 13:27, Naga Appani wrote: >=20 > Thanks for working on this! >=20 >> On Tue, Aug 19, 2025 at 1:32=E2=80=AFAM Michael Paquier =20 >> wrote: >>> FWIW, I think that you should be a bit more careful before sending >>> updated patch sets. You have missed an extra point I have raised >>> upthread about the refactoring pieces: the switch from >>> ReadMultiXactCounts() to GetMultiXactInfo() can be done in a patch of >>> its own. >>>=20 >>> So I have extracted this part from your latest patch, and applied it >>> independently of the SQL function business. Now we are in an >>> advantageous position on HEAD: even if we do not conclude about the >>> SQL function to show the mxact numbers and offsets, we have the >>> function that gives an access to the data you are looking for. In >>> short, it is now possible to provide an equivalent of the feature you >>> want outside of core. Not saying that the patch cannot be useful,=20 >>> but >>> such refactoring pieces open more possibilities, and offer a cleaner >>> commit history with less churn in the main patches. >>> -- >>=20 >> Thanks for the review and separating the refactoring into its own=20 >> commit. >> Point taken on being more careful when sending updated patch sets. >> I=E2=80=99ll make sure to keep >> refactoring and SQL layer changes clearly separated going forward. >>=20 >> Attached is v6, rebased on top of HEAD. This version is limited to the >> SQL function only. >>=20 >=20 > diff --git a/doc/src/sgml/maintenance.sgml=20 > b/doc/src/sgml/maintenance.sgml > index e7a9f58c015..6f0e8d7c10a 100644 > --- a/doc/src/sgml/maintenance.sgml > +++ b/doc/src/sgml/maintenance.sgml > @@ -813,12 +813,56 @@ HINT: Execute a database-wide VACUUM in that=20 > database. > > As a safety device, an aggressive vacuum scan will > occur for any table whose multixact-age is greater than - linkend=3D"guc-autovacuum-multixact-freeze-max-age"/>. Also, if=20 > the > - storage occupied by multixacts members exceeds about 10GB, > aggressive vacuum > + linkend=3D"guc-autovacuum-multixact-freeze-max-age"/>. Also, if t= he=20 > number > + of members created exceeds approximately 2^31 entries, aggressive= =20 > vacuum > scans will occur more often for all tables, starting with those=20 > that >=20 > Looking at commit ff20ccae9fdb, it seems that the documentation was > intentionally written in terms of gigabytes rather than the number: >=20 >> The threshold is two billion members, which was interpreted as 2GB >> in the documentation. Fix to reflect that each member takes up five >> bytes, which translates to about 10GB. This is not exact, because of >> page boundaries. While at it, mention the maximum size 20GB. >=20 > Anyway, I also think, as Ashutosh suggested, that if we want to fix > this documentation, it would be better to do so in a separate patch. Ah, I've found why you choose to add this doc modification in this patch=20 in the thread, sorry for skipping over the part: | For earlier versions (18 and before), the storage-size approximation | remains relevant because users don=E2=80=99t have direct access to memb= er | count information. Since we don=E2=80=99t plan to backpatch (I assume s= o) this | new function, the documentation for older branches should continue to | rely on the storage-based approximation. | Now that pg_get_multixact_stats() exposes num_members, the HEAD branch | docs can describe the thresholds in terms of counts directly. Personally, I think it might be fine to keep the gigabyte-based=20 description, and perhaps we could show both the number of members and=20 gigabytes, since it'd be also helpful to have a sense of the scale. --=20 Regards, -- Atsushi Torikoshi Seconded from NTT DATA Japan Corporation to SRA OSS K.K.