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 1vVjuP-006vZQ-0C for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 05:17:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVjuM-00ABkd-2s for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 05:17:07 +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.96) (envelope-from ) id 1vVjuM-00ABkV-1v for pgsql-hackers@lists.postgresql.org; Wed, 17 Dec 2025 05:17:07 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vVjuL-0015j9-33 for pgsql-hackers@postgresql.org; Wed, 17 Dec 2025 05:17:06 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-47795f6f5c0so33993325e9.1 for ; Tue, 16 Dec 2025 21:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765948624; x=1766553424; 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=agkaDXjsFi59sZJ1gOWFcM5yNAC3Mt8uflFgcnuJpoI=; b=WXNbgmBnFRzbWzAx29FcSge2oE2NT2MMS0dM0vJHQDdxFo1iRaLlZ/yuWmQDvOvzsW eEOvspmOYQV1mMxyWVLgjgBsT24fIC7Olg7ga3OzSJmaBXFM71k+6UWeEt+ceMM6idMg 2O4XAF5W7iK0H1ekpQ/YOGA+cpW/SXI7TiL+l7MKSf1JVO8rEM3EirtTPsDohVTa4K7K 7ZJTZMg0l4jxpD/YxuVPh/Ng2bA97LhsO0R4KDkRA560X2oa4Mpi8YRrJIbj9yCdNz61 px/3j0NLPXmBhwM/jpQQTHCQY4//BAgtTF8ypiBfOtGVU9fgq2YHkn4PFrQu61DO4S8v Ms0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765948624; x=1766553424; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=agkaDXjsFi59sZJ1gOWFcM5yNAC3Mt8uflFgcnuJpoI=; b=b28Ji3fCzzH5rJeNtCu31nOljdavEMBQc6Bgo2ek4zyVOLGwKHid/zAGLeHrXQiNk3 GFN7SBS3yGXTAadt0SVzzaESNC741HUSsOzfryRQ9QfeYQD//irpe/xYN/GjsvJqoR/y ywpPhMGn264iNpqBuIHxhpeOjNEZGjXHXiXezbbPvdj+aKY6hIYw75EkXpTKoD5zAgGh EJ/005F0PDwCHADmZYnof2x4+TkvmpdvHT0x+f3YfhTAuPMhjipiMtQ4E0To51pZZKw7 s963shUQmuiifvz8VaKmO/xXoOqhRUcgQEWvUsYSjuZRNnT85zpYWtQMyzzp91x9Jfgj nQ9g== X-Forwarded-Encrypted: i=1; AJvYcCX3OVDE9mhgvGfVb4+MQ2lURRWvJZS+oR19uihXK7Hhp2fvaHFRUTpa8Qm/RNqoHbZM1NKDVJsNFkP+BsCp@postgresql.org X-Gm-Message-State: AOJu0YyH+6pA+Sxt3LkB+XSWYxurZxVM8Wloa9X/gQYk0orpBxP+VZ5a K/J+c7xCfBD+6XscgqDICoVTa7x4M1vhUamCKlprDmTAitWTCKKIGQbUesAfOreNti2a3HnxwwG BQWnZI0wEOmJ+W79SpWvMdqDScZc5u3U= X-Gm-Gg: AY/fxX60KOk7OcqyWMXYJNy6VDOh+BJU0aWOEAa6yfRDBhAwZC2rg9OeSv/GN58DI0S p8yyk2otx6Sgj2EvfG2mIvZI73H/Ni8C8lBaDV3C8aOkuqesdom49Bsubf0PyNEo66F7BtA8q/S d8rIlFxGXZwGJ9I7eqrBuyCZigeldBSpzrXVwp4e2OLBYDdyNA8xzSnIlMDBgKyHrb2cr37CikQ CPWaVdbPTUIeL28U72yYzpaliLAImOD2DFlyUSMP+Buyt6Dhwww6DEQytnmAn4HYKJ23DAF7g== X-Google-Smtp-Source: AGHT+IGxg7wF7JiyDD3RrfXhGyDiEfilzXlFsQmvXBmRb9K06WkyQXhVe9wJy6tyAsZyoKcWff4gPu0ZTgs8VOR3MpM= X-Received: by 2002:a05:6000:18a7:b0:42f:b0ab:7b48 with SMTP id ffacd0b85a97d-42fb447668emr15390166f8f.1.1765948623989; Tue, 16 Dec 2025 21:17:03 -0800 (PST) MIME-Version: 1.0 References: <29f9e7abc90c3a4fe4a44026141c0d6c@oss.nttdata.com> <95850ce1-2d5e-4271-92ea-c2a02e36b303@vondra.me> In-Reply-To: From: Ashutosh Bapat Date: Wed, 17 Dec 2025 10:46:51 +0530 X-Gm-Features: AQt7F2o6Vng-0Pwr_kevNYfKvSQcmNkiM0vx-liucFMrNgDaLWgHbz3kL6zKy6U Message-ID: Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring To: Michael Paquier Cc: Naga Appani , Tomas Vondra , Xuneng Zhou , torikoshia , 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 Wed, Dec 17, 2025 at 9:49=E2=80=AFAM Michael Paquier wrote: > > 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. > > > > I validated the behavior before and after cleanup. > > The function correctly reports current usage (beyond the old limits) an= d > > resets once multixacts are removed: > > + /* > + * Calculate storage space for members. Members are stored in gro= ups, > + * with each group containing MULTIXACT_MEMBERS_PER_MEMBERGROUP m= embers > + * and taking MULTIXACT_MEMBERGROUP_SIZE bytes. > + */ > + membersBytes =3D (int64) (members / MULTIXACT_MEMBERS_PER_MEMBERG= ROUP) * > + 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? +1. --=20 Best Wishes, Ashutosh Bapat