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.96) (envelope-from ) id 1vVj0d-006mGq-0d for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 04:19:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVj0c-009xuj-0c for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 04:19:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVj0b-009xuZ-2t for pgsql-hackers@lists.postgresql.org; Wed, 17 Dec 2025 04:19:30 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVj0a-001AGU-1J for pgsql-hackers@postgresql.org; Wed, 17 Dec 2025 04:19:30 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 7C0617A0056; Tue, 16 Dec 2025 23:19:26 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Tue, 16 Dec 2025 23:19:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1765945166; x=1766031566; bh=XoNw12M0Vm 8DM+1H/AOZDvniPRRQyRaqC2+rBtwvHkI=; b=AEEorOIXbSSEQlbYv+lyE5j/U4 NFg8InmnJjW7n+7WlR6VpvEoAQYwkUR0fmd4WR8qj1dqX6DNvGYBf9/DaZlHcmsE yk2is73Rm6mwPG9Q/dgkyz/p+42G24oxBx39L2XjucxsEUjPP4QQkpnXgOugcYOe sVkRsQxDfTO9Tl3sHNM061cfEQDyTKNZgb/gRRoV8fIOR9WWsNFbjUVWLS63/uUd RCtZer7QeLYiwTNlFyRNmOoGqsoVZ6+k1SmE/dbzD7F5dJRwNojLoIiReTrAGmIg YSRnRjAwgy82IUQJTvPO8/4s228Q+hO3Ajb7+RealWJm9UIZXEvNgEbtqCIw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1765945166; x=1766031566; bh=XoNw12M0Vm8DM+1H/AOZDvniPRRQyRaqC2+ rBtwvHkI=; b=dSst1C6uiqSt9NhwWyrS/bNthJW4Oo9PUP5d+DDROhg8EUEgSts VxdmBYE1t4yBlLPCoAVglCnjf10ksnhzgyo+5Efa6YLAoN/b4lJWLt+xe2vtiTqu lKkbSANGMUi611h9K5T7vwMr/J5+Yw5mmq46qRUFYuH2PbdqItYU+E3YpuGE+H+M y40Xqhx9m/IbS+yHsjgObtAyRuMFowm42x3YSIAxpp/w3bfMIl3H20OO0QMNyEUS XfIM9bVGQHqWDHMoIthIRyAV7AlvkT/Q9PIsyOubR0FQO7n7kvQ19itW7fCcnKzF g5cHShV5eSkpaBxsQZOMUEMWn1Q83ooKHZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegudehkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeggeff hfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhn sggprhgtphhtthhopeejpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehnrghgnh hrihhksehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghshhhuthhoshhhrdgsrghprght rdhoshhssehgmhgrihhlrdgtohhmpdhrtghpthhtohepthhomhgrshesvhhonhgurhgrrd hmvgdprhgtphhtthhopeiguhhnvghnghiihhhouhesghhmrghilhdrtghomhdprhgtphht thhopehtohhrihhkohhshhhirgesohhsshdrnhhtthgurghtrgdrtghomhdprhgtphhtth hopehrvghshhhkvghkihhrihhllhesghhmrghilhdrtghomhdprhgtphhtthhopehpghhs qhhlqdhhrggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Dec 2025 23:19:23 -0500 (EST) Date: Wed, 17 Dec 2025 13:19:11 +0900 From: Michael Paquier To: Naga Appani Cc: Ashutosh Bapat , Tomas Vondra , Xuneng Zhou , torikoshia , Kirill Reshke , pgsql-hackers@postgresql.org Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring Message-ID: References: <29f9e7abc90c3a4fe4a44026141c0d6c@oss.nttdata.com> <95850ce1-2d5e-4271-92ea-c2a02e36b303@vondra.me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Nph+9U8F3Ih8joUd" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Nph+9U8F3Ih8joUd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 13, 2025 at 01:34:47PM -0600, Naga Appani wrote: > Documentation changes: > - Removed the NULL-return discussion from func-info.sgml, as the > statistics are now always available. > - Updated maintenance.sgml to clarify that exceeding the historical > 2^32 member limit no longer causes wraparound, but instead triggers > more aggressive vacuum activity for disk space management. >=20 > I validated the behavior before and after cleanup. > The function correctly reports current usage (beyond the old limits) and > resets once multixacts are removed: + /* + * Calculate storage space for members. Members are stored in groups, + * with each group containing MULTIXACT_MEMBERS_PER_MEMBERGROUP members + * and taking MULTIXACT_MEMBERGROUP_SIZE bytes. + */ + membersBytes =3D (int64) (members / MULTIXACT_MEMBERS_PER_MEMBERGROUP) * + MULTIXACT_MEMBERGROUP_SIZE; This is the key point of the patch internal logic. And there is one thing that I am wondering here. The amount of space taken by a number of members depends on the other compiled constants from multixact_internal.h. Hence, rather than calculate the amount of space taken by a set of members in some code hidden in the SQL function, could it be better to put that directly as a macro or an inline function in multixact_internal.h? -- Michael --Nph+9U8F3Ih8joUd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmlCLz8ACgkQnvQgOdby QH2n6g//bly+0lUwTrc/iGg9+2+014RN3J1FuVF/GwB4pD9ZyyrGAxn5tm7++0JI LrYZiKUddFXpM2+3Sa/CikOCiV2U4R+36fDhUmDeQtatUno+onxtfi+8c10TNai/ N4LOmqZwzfu9WAg7hxKqS15Q0hg/KIzLJkbU4jL7CKJaV0Gn1a0jZwa1AhakB1Uz R2CygBdkgsfh2Zp8VngOB2ds+AIldHMBOZ5Za4+iS6QEk0g4yIaR6TreFk1LD5Ek yfo5xNSFMSeXJipT/lYMYIPYsxLKS0ylQz+VAV5VUwtdv5djS0PeLmwPT79ENCCP tTWp0aQoSm7qgb3xkwHwGB/fZYn91XiEbq04K7O4/zE7zzIb7JV0AurSyKZEuNHN w6y+EcO+iPK9B668Yhy2piiKaJG/iYbKVWHxcBrHjOlTIz9bAK98uBcUkJ3LVO0k e+yyD0o8JEWeUPXg1/Z9KUAtOaOJBy4/PSP1d2KyjZZctjHIHByCEFkgFcRsyIZV g+qii9TJ8JWPEoku0UpXUkGQpqLpTAkTKM9Q8lwEvYZPRcM+K4zJi3cO8TdKoxc5 Q1aOgpaE63bjq1jvaM4+itMo4E5LBi6c1W0PNEHaRqg7VIL2wUzZYGr3AVK5qz9J 8YuU36qgSdhKvKYfRDsEYo/V+TlWGi11gswHOFDHgCY8Q07hYew= =pAIc -----END PGP SIGNATURE----- --Nph+9U8F3Ih8joUd--