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 1ux170-009odU-5j for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Sep 2025 10:34:38 +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 1ux16x-000Sdy-UE for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Sep 2025 10:34:36 +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 1ux16x-000Sdo-IH for pgsql-hackers@lists.postgresql.org; Fri, 12 Sep 2025 10:34:36 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ux16u-000Mfn-1u for pgsql-hackers@postgresql.org; Fri, 12 Sep 2025 10:34:36 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3e7512c8669so1238318f8f.0 for ; Fri, 12 Sep 2025 03:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757673272; x=1758278072; 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=A5tjBANplpipGP3ilEjOvHiRGCNSRk+sVRwrj1F3vA8=; b=kMqMuAVi+juKXwlnJWtTIIeLABJbFDGuL3VbXwqU64pNcyWOHcvqcYGsIh0EZ3vq64 OMbi/aMn4rGE8oV0OiLS/BZtMgZwTwb9EJB0Wy813zK0/ZbxE3InY/UxW3hPE8nXtVk9 Oi8ikkhpSfTAglVM9+oqhREbrj2WYp+CsELOi84Oa5jousFCM009vKGQyO40E+JmWmEz JsvSC1e+6ZuRenjg8p8XExSbbx+1OvjgkrLYdZaBuFDgOLhkjjnXoTPl53Nf81W74uyO zR3Ws48/ydkLDgHVovbmqQEUg+wqR1Np+q8d2WjRkDJ6DW5quLOeo4RbdCvFXMoAs48i 9eNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757673272; x=1758278072; 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=A5tjBANplpipGP3ilEjOvHiRGCNSRk+sVRwrj1F3vA8=; b=ZbtQtFo6YZV3U19jmYyl+NwUr1bB2TTGLPr5iDpLrOUXt0ZVTcB/X+9IObV8vKrUdT di/DR9Hg/28X/18GgTHSV6DBK44ealo6cdlHnhJaLiqXLJzyxuC+UXSVW+HqZIfPEkln aq9aS7mu2MP2lOlDLFY10eE7k91f740sXXE+COpDTqDg1Vp4E6BbxTLnWovGFAKSbTa0 87BfsHXHKYlM6bOskbtHQmg67uita/u/PLjT0C30f7q32JEyiLtdEPW7xEUorjK5H+u6 NfbZKZy7OwPHUn71jT0HjG5pBjhLUybl2dOQ7YlWmFYuw6ypiOKhT/s6rvbYyNsGD0Q4 aaMQ== X-Forwarded-Encrypted: i=1; AJvYcCUsQCH4Cvo4td5qH9Rzo3IQdEBmi32dGyAyoBfsge7Th2avkS2n9pBkILwLssQEIWuPUOHbrjFT9luJd9ST@postgresql.org X-Gm-Message-State: AOJu0Ywk1vErXzNTccEl1mC/4xEpnDllpfXgEpLV0DkAnFcUIY5IT1oE IQgk0/nDgITG0IAFd6gyAQcnm/EDf3BwN0lCNp+12ncltlVxmonW1l/VDZPntN4dMTwK5EGNntl AF9mf+LKwN6D3SepOU8ikRYetuqG5ZPA= X-Gm-Gg: ASbGncvhUVYiGtPgutWztQIkP2DMHiJAHr9LQr5TFsl6GF0jbbF2nmvPcbo/8ZBFB3C PcD+1Vpkp6CCKo8fdfeqyUTKdnIZ542wV5NbYEn7CxdHc/uM/ZYa+YB9pWClzpPs8LUuN/kSkqf H6g8x5WZxkITn+h2k73H4N725o/ev5aX7Yqtl6xsYEfh9eCg7mr0VpsJ9IaRjToOyV2ZrseAyfn Rrm3Qw= X-Google-Smtp-Source: AGHT+IHslEctwZt0VhptaFYg+E+Xd01HjAZF6hDBT3Nq3VEwu52UY72W6tK7l+FrOzO0Ef6IlG5f4qkb4XgxPpv4/TQ= X-Received: by 2002:a05:6000:420f:b0:3cd:edee:c7f1 with SMTP id ffacd0b85a97d-3e765a3d7d3mr2685621f8f.56.1757673272081; Fri, 12 Sep 2025 03:34:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Bapat Date: Fri, 12 Sep 2025 16:04:18 +0530 X-Gm-Features: AS18NWAGQx0iFsZvRgSboZ1PywhbIbXRgp9vpGRhQazkAg-dIln2bp50Haca1tQ Message-ID: Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring To: Naga Appani Cc: torikoshia , 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 Fri, Sep 12, 2025 at 9:03=E2=80=AFAM Naga Appani wro= te: > + + + Returns statistics about current multixact usage: + num_mxids is the total number of multixact IDs assigned since startup, + num_members is the total number of multixact member entries created since startup, GetMultiXactInfo() returns following *members =3D nextOffset - *oldestOffset; *multixacts =3D 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 =3D> '{int4,int8,int8,xid,int8}', I think the first parameter should also be int8 since uint32 won't fit into int4. > > > + See 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 relatio= n. > > > > 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 > > + > > + The function returns NULL 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 NULL 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. --=20 Best Wishes, Ashutosh Bapat