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 1w6VNd-004Miv-0A for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Mar 2026 15:15:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6VNa-00EWSO-33 for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Mar 2026 15:15:15 +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 1w6VNa-00EWSF-21 for pgsql-hackers@lists.postgresql.org; Sat, 28 Mar 2026 15:15:15 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w6VNY-00000001fhk-1Fqb for pgsql-hackers@postgresql.org; Sat, 28 Mar 2026 15:15:14 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-66b0f489f3aso4027734a12.3 for ; Sat, 28 Mar 2026 08:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774710910; cv=none; d=google.com; s=arc-20240605; b=MUfLPqM19C6RwH6vBgIsOLiG3gP+juQwv0/31fgF6BAOav2Np8hoDmksmAjxKOh1ri uSlp/C7eAJe01oDcb8omWc3sbcdMiqp32xy6EyVA7aa+jmz+Fbe8K2Qax2AygXrIBIlp T7Baecz9uGgbXsBNu3xFeYLjO0Ox4ypXdesOPgb4xJ22LW4B0DEr6uQss6/zvpOLb28n a8IDkL4+V25ZjzJHOJUshf7TkEVRxl0RHkUZDaMUYzfIXjgqQT7xmaciDkK5nU/zLWRW hDpaJzrzrHeC95QYCi2DXLKelGT5K935+YRyp+X4ZdsENbfmg8jCbJSV/8oVNoqR36df dMKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=N4eHOGDmmqHZoJENL3DdNLS7kzJNM8GH/q2nlf4mdqU=; fh=LtpMHAYFTSB4HECjTJuqq/aZSIkoIoAIMiI8Cmr6VS8=; b=DFCylkVZS6o1866g8Y4Na5wmHyFjDaTPHoizO7f4UnLlZ2zJKDjTHsHqTRfenKVxED Q/TcsLt16qhZK84XwAhzuSIE3R8Lg1MGEJRIRK1R394cKWmVofYFRLgiIFeRaGWg/OjB oLu8uZ3EOwWrWfVeT4vQ88HD4e7POYb1NM7pb8DHL+s8ck7b+Kv87UOxHrKvSbROuQMv rvS5c1gjpEi+D/azycdkwYHM8MlcFCxLPHzmJZpf884skkXD03wS9TCBn5QzbmhNol1X TCkRowcGriGxhygl8JNe7Fl/6Hmxk7yNBHaeNd8dbWDjRLWTsiZAYwAsmaE3HWsRNKAI gLbw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774710910; x=1775315710; 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=N4eHOGDmmqHZoJENL3DdNLS7kzJNM8GH/q2nlf4mdqU=; b=kg58GtTxvWKRg1mxU/bVeLVgZLZ4/EJ9ScxAnOIVIGjL7ydL22Fk3o6hQjjkMLYtv6 IB0K/yYJlHkHMknFckH5XkUA5LnkjRzce039m6YgTskcIoaHRqfC0UNAn1Sxy22siaKY mv+KPTqvbF4I4EMPwa/8cikkWv0qUST1UvYcXDTKUhhstVoewvQy7t+YVuIprmBGqezP UtXFSki/Sutt/lPj9yoE7BqsKKlvq+uUF2wSkRWdZrTTfM+utLnM1YBkddNmSIbn9V86 RwmlIsafHoxmvdphsr2cffvH3oNuwO9IrHXAyOcT838QIv0vFunR+LeUY9KsCIlicpUh TVUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774710910; x=1775315710; 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=N4eHOGDmmqHZoJENL3DdNLS7kzJNM8GH/q2nlf4mdqU=; b=N85PC2+AAXyw9IRlpPI+XtsSPKKgkQoTxKV3GQWhVN34gPpI2TBaHyykNcQlqC9VSm TGkEkL3M7a+dtqdj7fe+/+cZUYLZ1RfEEPWzWvATFOGtwYzVBBmq6dr1FDM1QjpRhz2K QYhUBGDk2Dyy5UeMcDQFe0wwleXnDQ8xaHFUptgXsciteNOQrsQuvwgw4sdtdy6eRF57 vYd7+IN9oOMhAkFGPG70R405jeC86c0z3kQe0G9TH8/SdpAQHS5XOl+wQ13VvnUar/x3 dXsNHsSy6vLi96VI6V9CjsboJCytKSDOLb69Exx17F72wAttWFd/ewW8egUqbq6LnGLW 6eTg== X-Forwarded-Encrypted: i=1; AJvYcCWP8MOCZyq8UGbKapXOxXEQDutvuybkWPGR5EOnBFxDYYKHQXt6+5pl59OqpePkSqpq+OCKXjIgxWXpoor/@postgresql.org X-Gm-Message-State: AOJu0YxnSmfXXsbAl2t+lR44TaKSmWzbF2dX5APvr7/PLnSloLvi6atb L3nMTwInyVE/V6u0OMlLFbjfWtiY7VRzghKWniWIhNPLPa4iWP7k8hr0Bp/620FvN88gmgyLwq4 q2SK+JiThGJgF9uXjDs19+BcbrnOiaYQ= X-Gm-Gg: ATEYQzw2X7wrHnDP3SWNYWczvhg0tYCrzg487RaexVvscpNDFnWhEFZlAWkDCYsFnDs CZtF3lsr7+zLlOXfLp7W+TK74lBsH4Sjb2L8KvS01dlyeNtqzwgM9UZ/c889pyB+xVnzKe4VN3Z NUL8UmhW7kogVQXyPHASVickksq0dAdGhoK2PNyDV8qf+4zR47Z1n8xSgbWy+Gd0Kfx+shd3DNT 1yTbgu6kskLYbm5zQyIwdg6Z0rR59ZOqD9F8mfG5zLB+GCWi0y4D1IbLAJybI8jmvQfSqziLjQ6 AVkV7C+q+dCzUrwonXS4cGOobxsdNT4Kd7dnN1+XKBgKm+Ka99Dg/FDvMx4l/6l0lFKzyrGR51a xTcCKbEfu X-Received: by 2002:a05:6402:1464:b0:665:495e:5908 with SMTP id 4fb4d7f45d1cf-66b28b5666amr3969841a12.18.1774710910115; Sat, 28 Mar 2026 08:15:10 -0700 (PDT) MIME-Version: 1.0 References: <89742024-d51a-c66b-90b9-67f837072cd2@joeconway.com> <3b1683bc-2630-a0d0-6083-8a45aa1b54bf@joeconway.com> <5dc12198-80ff-4e70-b187-11ef33418411@enterprisedb.com> <12f6d0f0-0b5d-46e3-afa9-c35bd418d49f@joeconway.com> <14ec974e-7e15-4bca-b93c-687502748865@joeconway.com> In-Reply-To: <14ec974e-7e15-4bca-b93c-687502748865@joeconway.com> From: Xuneng Zhou Date: Sat, 28 Mar 2026 23:14:58 +0800 X-Gm-Features: AQROBzC_lmzMX6v8XfBSOVOLr6Ur5vcr8dC3pRdtuqhBcEQ1wvHpWahfH_fAC_o Message-ID: Subject: Re: RFC: pg_stat_logmsg To: Joe Conway Cc: Michael Paquier , Tomas Vondra , Gurjeet Singh , Masahiko Sawada , PostgreSQL-development 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 Sat, Mar 28, 2026 at 10:14=E2=80=AFPM Joe Conway wr= ote: > > On 3/24/26 04:05, Xuneng Zhou wrote: > > Hi, > > > > On Thu, Jul 18, 2024 at 12:33=E2=80=AFPM Michael Paquier wrote: > >> > >> On Wed, Jul 17, 2024 at 07:43:13AM -0400, Joe Conway wrote: > >> > On 7/16/24 18:14, Tomas Vondra wrote: > >> >> As for the feature, I've never done a fleet-wide analysis, so if th= is is > >> >> one of the main use cases, I'm not really sure I can judge if this = is a > >> >> good tool for that. It seems like it might be a convenient way to d= o > >> >> that, but does that require we add the module to contrib? > >> > > >> > I had an offlist chat with Andres about this IIRC and he suggested h= e > >> > thought it ought to be just built in to the backend as part of the > >> > statistics subsystem. Lately though I have been toying with the idea= of > >> > keeping it as an extension and basing it off Michael Paquier's work = for > >> > Pluggable cumulative statistics. > >> > >> This may live better as a contrib/ module, serving as well as an extra > >> template for what can be done with the pluggable stats. Adding that > >> in core is of course OK for me if that's the consensus. The APIs for > >> pluggable stats are really the same as what you would store in core, > >> minus the system functions you'd want to add in the catalog .dat > >> files, of course. > >> > >> I'd like to get it this part done by the end of this commit fest to > >> have room with pg_stat_statements for this release, but well, we'll > >> see. As far as I can see everybody who commented on the thread seems > >> kind of OK with the idea to fix the stats kinds IDs in time, like > >> custom RMGRs. That's just simpler implementation-wise, but I'm also > >> looking for more opinions. > >> > >> > Hmm, yeah, I had been planning to include postgres version as part o= f the > >> > output, but maybe it would need to be part of the key. > >> > >> Seems to me that you should do both, then: add PG_VERSION to the > >> entries, and hash the keys with it for uniqueness. You could also > >> have a reset function that performs a removal of the stats for > >> anything else than the current PG_VERSION, for example. > >> -- > >> Michael > > > > > > This feature seems both interesting and useful, yet it hasn't > > progressed for some time. Looking at the thread history, the patch > > stalled around 2023 in part because the pluggable cumulative > > statistics infrastructure was still under development, which offered > > an opportunity to rework it on top of framework primitives rather than > > carrying DIY implementations of shared hash tables, persistence, and > > reset logic. > > > > The refactoring opportunity is now basically available. The relevant > > infrastructure landed in stages: > > > > 7949d9594582 (Aug 2024) =E2=80=94 kind registration, dshash routing, fl= ush_pending_cb > > c06e71d1aca (Nov 2024) =E2=80=94 write_to_file flag, enabling opt-in pe= rsistence > > 4ba012a8ed9 (Dec 2025) =E2=80=94 to_serialized_data / from_serialized_d= ata / > > finish callbacks > > > > I=E2=80=99m considering picking this up and 'd like to move it forward.= Before > > doing so, I am curious about whether there was a consensus on putting > > it into core or keeping it as an extension, and whether there are any > > major blockers I might have overlooked. > > > It has not progressed mainly due to lack of time on my part. It is still > on my TODO list, and I would like to find time to complete it. That would be great! > Personally I would love to see it builtin to core, but an extension > would have the advantage of working with prior releases. In any case, if > it is in core, or even contrib, now is not the right time as it has zero > chance to get in before feature freeze. It would make more sense to > discuss this after April. Yeah, integrating this into core would make it universally accessible, while providing it as an extension would allow earlier versions to benefit. Certainly, it should be considered for upcoming releases. > That said, if you wanted to create an extension on github or whatever > you can of course determine your own timing. > I'll try to create an extension on github. It would be fun to play with and help to learn the new cumulative statistics infra. --=20 Best, Xuneng