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 1unyTO-00DlEc-QV for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Aug 2025 11:56: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 1unyTO-00GBbL-25 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Aug 2025 11:56:22 +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 1unyTN-00GBbD-Mh for pgsql-hackers@lists.postgresql.org; Mon, 18 Aug 2025 11:56:22 +0000 Received: from mail-vk1-xa2f.google.com ([2607:f8b0:4864:20::a2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1unyTL-000Sfn-2j for pgsql-hackers@postgresql.org; Mon, 18 Aug 2025 11:56:21 +0000 Received: by mail-vk1-xa2f.google.com with SMTP id 71dfb90a1353d-53b173aa4a9so2773908e0c.1 for ; Mon, 18 Aug 2025 04:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755518179; x=1756122979; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KI0e+Vj/Nc7FJixvAan++tpFR8PXsbaTC/8tK5drAhE=; b=RWg49mtzIi7Kck91d1CpZnKywApzcWm/bQ5hREulaModBR/5dGiOrtdzAlt1GIgNi7 laCmAn2tJC7e3id5/VIK4zHL/39jStJ3A+Elf+CBWSRaHGkWI1fEXE5+MrlpL86x+zs2 arLw6YVJeibV+q/yEmszRxA51u9hONm9ggH/sgDhN5SjYu4G4oKZf7GQWrgKQ+dEt6P1 VmmgpNAP42PPlXMMXULvLq+RYL6zTZRfAEan0y4FtwvJ0n98enh4todGAjACixenfSqU dJWyGQJZmmE3I5MAMq5eNuONv7z/pamY/EquWceecOWrye5sM+FSvB/YHi/Rh5sW+Caa PCNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755518179; x=1756122979; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KI0e+Vj/Nc7FJixvAan++tpFR8PXsbaTC/8tK5drAhE=; b=RFXNtNVxQs3093gIYQsyHS4ZMGaU7GPrAboZUegaUuZMNMFsXVRmDah3m0wxp7W0nW xAjJ8J7/83zdCJyJHjzGv0bTMhO59vRv7qiflGD1/7p1oG6FRd9LABKyLqdWFQu6ExpX qK5EBDrTf9RiPxOcD/uIkLMbbc3S7sRAoyAUpnI7pKRRmb/Kbjuj4VTWKke0mwEN+0fx w5bVMrzLLBYwldtgFCnEH8CYJxC8WjG9xZRbHmpG1CQEKX/70QllHHsuoEAGDF+sEt4u qOl+/VgXsdcJHpVFnRfE1h4iqz+hKYpj3gc98FWAoUk2U/axoe8bS4rhReMKfPLkesOV jPvw== X-Forwarded-Encrypted: i=1; AJvYcCUx9QLClf8L3RFCmc1wILFLKXvW1pRROgcBYV/6oBoIdGvazcnxy1CtQGpvrtVdztJYpbbNuKjWijjr1wa+@postgresql.org X-Gm-Message-State: AOJu0YyJ5WfNQPkT9QAKPmDTFVEvpu+yHcJgAJujDy/CNt8zF80WdOfk 2YUYMAVTvjlLi5agoqX4pj6b7hxSsHAuzHmdE3asGQjgQ1PSE6LbgNwopDx8h/b/uepiZjo9p5U z6LsfFoCYE4puD5LSA7dDS/KM+pavMAk= X-Gm-Gg: ASbGncsEZK0DIvZ37Nf+vHi/PA4WeBzPwt1gQqjWn1zAPdsl568ZDsNApnm0FPueWVT 0ZO4nKbs/vubfySFhjlgFezrcPPx1J8D/bZV2kVLnfGE44jQrnum+lpBOBf9GcJCc1KDFoA+VuI 9XjnEkNJyxZn959lJU1lJV9RIdDls5MegiSPl+CVGnIh0PmcTQQhbCuV5lNcO/xAfacrvBuuIuP FUm7IC1 X-Google-Smtp-Source: AGHT+IEW7U1XCYHybnW5mtWF/vr+MKq23CL1Wupl3GU2faIq6sVP6gnnMReQPr/xCMo4DYXT+Kpf6ytV9qj9tzTS+Yo= X-Received: by 2002:a05:6102:1489:b0:4e6:245b:cf57 with SMTP id ada2fe7eead31-5126d406715mr4576028137.24.1755518179496; Mon, 18 Aug 2025 04:56:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Bapat Date: Mon, 18 Aug 2025 17:26:06 +0530 X-Gm-Features: Ac12FXy56aZ_OVePxUjIY7yPjdWq9TIBpn1kKWRTtaIswh_BTUsUtYn83fOqKn0 Message-ID: Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring To: Naga Appani Cc: Michael Paquier , Kirill Reshke , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Aug 17, 2025 at 11:57=E2=80=AFAM Naga Appani wr= ote: > On Fri, Aug 8, 2025 at 4:33 AM Ashutosh Bapat > wrote: > > > In case each member starts consuming more or less space than it does > > today what would be the basis of triggering wraparound? Space or > > number of members? I think we should mention only that. > > I updated the docs to describe wraparound in terms of member counts only. > The earlier mention of disk size has been dropped, since the thresholds > are defined by counts. The current document says "Also, if the storage occupied by multixacts members exceeds about 10GB, aggressive vacuum scans will occur more often for all tables, starting with those that have the oldest multixact-age." - do you mean that it's wrong. Instead of checking 10GB threashold, is the code checking the equivalent member count? If so, I think we need a separate patch to correct the documentation first. Can you please point me to the code? Documentation should reflect the code. > > That=E2=80=99s a cool idea, thanks for pointing it out. For now I have ke= pt the > SQL function focused only on exposing the raw counts (num_mxids, > num_members, oldest IDs). My thought was that keeping the API lean makes > it easier to maintain across versions, while leaving any derived > calculations like approximate storage size to SQL or external tooling. > This way the function remains simple and future-proof, while still > giving users the building blocks to get the view they need. > > I=E2=80=99m happy to revisit this if others feel it would be better for t= he > function to provide an approximate size directly =E2=80=94 I wanted to st= art > with the simplest surface and gather feedback first. The constant multiplier which converts a count into the disk size is in the server code. Duplicating it outside the server code, even in documentation, would require maintenance. GetMultiXactInfo() may not do the arithmetic but pg_get_multixact_stats() is lean enough to add a couple computations. If size is being used as a threshold, reporting count is useless because user wouldn't know the relation easily. If count is used as a threshold, reporting count makes sense. --=20 Best Wishes, Ashutosh Bapat