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 1ugFOV-000Jjm-2c for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Jul 2025 04:23:24 +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 1ugFNV-0049lx-37 for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Jul 2025 04:22:21 +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.94.2) (envelope-from ) id 1ugFNU-0049lp-8s for pgsql-hackers@lists.postgresql.org; Mon, 28 Jul 2025 04:22:21 +0000 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ugFNQ-001EQz-0s for pgsql-hackers@postgresql.org; Mon, 28 Jul 2025 04:22:20 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 7D3F81D00063; Mon, 28 Jul 2025 00:22:14 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Mon, 28 Jul 2025 00:22:14 -0400 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=fm3; t=1753676534; x=1753762934; bh=m95E/7UtiT 85u83yBc4Nqf50V3kjBw2cRwPjvdY0mWI=; b=rCKatiz+Fs8BM71SKUXa5OJfAP 7ZX8bUxqrjLDjDZbYKxkLDqFCgBG+9OnMwRfm7/8SeYyzLB5biQAFEZLWZj+BR3y XALHi8WQcjBH59ZLPWpSfJvV6OZ2QxIHvR9Y+DOH4WmpDU4jQYc32UF9NEFXkecx 0MBsJP4nT0BcdfCdgkN5b8JeZJ/YIYmQxB26pG/n2dzp9JJhgFLzNGXsN1Jhlko5 lmk8OzDgvasnoagkrCjlgS3yAY5PVdPvUyr7fEKTqw/KlUwfGKuEyARiBWcx4KMV HupXv9pLouUpF/Y3O2g3gjoOclqQIxmvn1TGncelblWzAWVg1Q+pCi1/RuBg== 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=fm3; t= 1753676534; x=1753762934; bh=m95E/7UtiT85u83yBc4Nqf50V3kjBw2cRwP jvdY0mWI=; b=lpDeOX9XD5Bix9MoBd6EZeSMzwFkvbPT1LF3b+ZfbE1uiMLUacY 3a2a7mimPqEQqmH134lWl7DhrtVYWvn8cidDvXc1Y5gM7O82BBJ6T4PAsBhuCr3l KHLqe2WDMvSGpti9fItYVuH2avPUwSMYqMuOSXBdCtLHXultoQWaQABZ2NuhAyWK 8ua+mvpWyhM5eXiJxvjCyyVvS8wlicX55tmOwcA+h6aw3JYdcwOBWUc/GOGoBT5g 0E86/Gq/mrcDzEsjphbYEZbCTnhHA8NRcJoMRH64LITz9d5RVpSeOLTH/8V1W3lC lFJvohEAjm4SsLABMvCyDTMvFATMoh/54wQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdeluddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeggeff hfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhn sggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrshhhuh htohhshhdrsggrphgrthdrohhsshesghhmrghilhdrtghomhdprhgtphhtthhopehnrghg nhhrihhksehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhgvshhhkhgvkhhirhhilhhlse hgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshht ghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Jul 2025 00:22:12 -0400 (EDT) Date: Mon, 28 Jul 2025 13:22:04 +0900 From: Michael Paquier To: Ashutosh Bapat Cc: Naga Appani , Kirill Reshke , pgsql-hackers@postgresql.org Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iXb5+Ha62k2Gw7JJ" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --iXb5+Ha62k2Gw7JJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jul 25, 2025 at 04:27:37PM +0530, Ashutosh Bapat wrote: > In [1], we decided to document pg_get_multixact_member() in section > "Transaction ID and Snapshot Information Functions". I think the > discussion in the email thread applies to this function as well. Yep, let's be consistent. > Throwing an error causes the surrounding transaction to abort, so it > should be avoided in a monitoring/reporting function if possible. In > this case for example, we could throw a warning instead or report NULL > values. Most likely returning NULL is the best thing we can do, as a safe fallback. > The patch needs tests. Indeed. May I also suggest a split of the multixact SQL functions into a separate file, a src/backend/utils/adt/multixactfuncs.c? The existing pg_get_multixact_members() relies on GetMultiXactIdMembers(), available in multixact.h. The new function pg_get_multixact_count() relies on ReadMultiXactCounts(), which would mean adding it in multixact.h. Even if we finish without an agreement about the SQL function and the end, publishing ReadMultiXactCounts() would give an access to the internals to external code. +PG_FUNCTION_INFO_V1(pg_get_multixact_count); There should be no need for that, pg_proc.dat handling the declaration AFAIK. FWIW, these functions are always kind of hard to use for the end-user without proper documentation. You may want to add an example of how one can use it for monitoring in the docs. -- Michael --iXb5+Ha62k2Gw7JJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmiG+uwACgkQnvQgOdby QH2XAxAAm8E9ZdhwZiBJdzqdyd/3by2MNpwjL6mk3XVATOvAuoAU1ihxYsgr8Rub yTV1GAKHyibHCu2UQVFI9SIu8twM7oigbJC+uRwSxDwk/rKKY5XW/RAvMENAX3HL PLPnBf+M29kY8t3pFhf1b5NcfE69z/zeyC+usBw2o34PkjdgMUDrVyY1fpLgW9oU QYnA8r+ik3HumfjxLU/BzcIc2dYdPdq041LXocWsrGfkXlbzIBU9/J5AxumZc3PM 8Vfhzs4U8U+Qv+YNgLTBg2HVbQEKSSHNRkSgSuwDRq1qWdU0xsPaC4nsOf+uZ5xt q+rA96HOCQEkyeQHwsHWZHZvM+m+zEu5FYXSKheuXGGCaCkfd46AOFCKzHk41yt8 NyH4lkazhWNB7KK5aCGHyFFCgxFRpVIt3r/StkubrJrlxCRnPjQHWZ5Im0Vm7iKG T7bvj4jEpJD9JbVR4p8yZLwomXl3ownxEswCX8zZMPc3yR3Q28f0fmoyBMS02G90 Ldwm3+TcKwn72w55betDoJIEXeAT2gMz59tHZnA8TkUaCbkq5K5L9yc7kiCJCMSR 8YmxQ1rJv2ObztYJNQEYb9hdlSRdIiK3fR0ai3oGk9X4NPk7H4IttVc5K4BNRlPl cEXvMAdzMlyrAIXo3aH+DEAR8eGatXd/3ANq1LcJbMzVhSbF6f4= =A5vt -----END PGP SIGNATURE----- --iXb5+Ha62k2Gw7JJ--