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 1w4wlh-002jE3-1x for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 08:05:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4wlg-005HyI-06 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 08:05:40 +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 1w4wlf-005Hy7-1z for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 08:05:40 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4wle-00000000l6v-1F8o for pgsql-hackers@postgresql.org; Tue, 24 Mar 2026 08:05:39 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-b97f9587e6eso690177666b.3 for ; Tue, 24 Mar 2026 01:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774339536; cv=none; d=google.com; s=arc-20240605; b=cy9s8exYSXblEPDvLQwIwgy3il70ftJtZTcCXCmIFA1Qyf2BZvYKEx8Xm5E+u71EyD Iey2aAso383Yhjw8i/p9mjB7k1hetjh9aPFjVlDJw6VP0g8YDRB9tq6s9F72IBvPYy7e 7c+eQhEN8SwQd0qySgEQ3syXIyAv4aAx5UgFy/jEsuo/mWzM3yRXNh3gDNO+/Jg4/brq NsTuu0c1GrU8fQYpTFADogEdMuutoXmbDCkjB7a5SYyIyqAFLy+iWW2WavtZXaSdRha2 O4UJKRIoJNVYMoro1p3lrVoJ8Ny6oNJA4AOrgKSdbmtiKU1UGYf1oXyhwyrysaTsJTkk 9yKA== 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=7yRjX3I0YtTQY5pw8Uzqq2hjiBpJhca5jB3GBNI4raE=; fh=7djLP0nsjXIxZezqVaHaq13SB8rtrn9FDonzurqCQUs=; b=MUDWmtIDNHwKh9SVRoOXOgjxNcXhmj8Xspjmk2RYxSkedhg4mgYBmFUOogot9gW8mX /qe5vTUYXiC1dkWQSdDdPiBtu1ehXiMtxcAAqdKWyVvEeJdRnMRmc4qZn+1eMHOSr9h8 Qo0sjI5i6G2FZFhOIL0/eLwb2lxaYxsnA1/aiKpma5xOHHxZW67/7Nbqm8KTDSVqXN2G bNZL5J/qve1tKg0i4DgQTsyJaYB8VVGtdnD3jnG6p0o12teBmZSV47qcxCEdfsQogtdB 8/l7NVuF4U8i4YhkI+seBXwZi1J8viWOwzpP8su5LD4wuD39lmmAfCilQpPoeLNe7mnp G/Mw==; 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=1774339536; x=1774944336; 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=7yRjX3I0YtTQY5pw8Uzqq2hjiBpJhca5jB3GBNI4raE=; b=VKTWwWGkG4/Toy7uMZF9PNuXUXOVcoytFAD4Jp+JLdzSu9WSxiSBWWyg1167KQEuO1 oxYttldR9PoyXe0gCTRTlYg6HWGpRnNR68Xt2CpKZ1ZSKrUPIhbbTDIJkg1FW4kn4dWm yeLcnZ3/mZyv08N1/+d1TeSWbSUKk+yoOH1DbjNldfqcF8kZLC/SjjWcWyC0M8eVO89c +6UhUbHVWmqDs6n+tqVXRcNp5wr4pLCVo82yv3IMCmUVN9qENjli8V17vxu1dGXp9d2y ARHqbNT3PC73pqc24fp7u99xGpl7+inSL9C4SaqxvErGIiJYEPeQA/UEdo6dwaApjE33 okDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774339536; x=1774944336; 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=7yRjX3I0YtTQY5pw8Uzqq2hjiBpJhca5jB3GBNI4raE=; b=KccMUifuP2wO3NpqE4mmH1jThl8KCjzK47XqCLqKYh1SJUEBorE/pxlUsi2YczcZpa hrdvHY9AZFOL4fndRHrBFYM1ozTm81Rw9ci8tzcvauIId1SBNHlita5Od2/fR1wyagGe rwNdAstdNMU8IJG0LRO/YfgxUxccckGkL0KieijVyjt5sbBGaP+P9f+NTl/GBa4LRGnU 0u3AdfhXuniMTaF0axsmeSfbs7r0n6hV331qJulzvA8ljyZvtJZyZbUUppCjkdcK8/hb k0IqwJRGJt3T/3Y4hwwjbQJutnRnitl8FJFyIqQfWRimm6tTVnFfVzizkNKvaf00GyJO ijGA== X-Forwarded-Encrypted: i=1; AJvYcCXTDLctizCv9Z5cbVnKE6xzmEtVVCTlSSDX+YTLct7zNpTpPKkg65pTOk176AyMga3ojv+NMi/A1fHJ/AyR@postgresql.org X-Gm-Message-State: AOJu0YzvHiY8geq3hLB8SfCi9ZzpN8qgLJolrquEM94VtuXdi5OeiK/t G6mquClPKWi24fyVPEY/lpX5tc/77Q5nB+pWQ4xOXyOauOowJ0AQD81mcuMeK97iXHqOECOmHQ8 P4uq+KM5HpEp4GrJQiEqS9NHbb8MlmHc= X-Gm-Gg: ATEYQzznzlven3wqq4ttzg/zGu+9HCcGOcrc9cRQCzxw3WbW3g01YiZ6WoooV7vrUI0 RmtGPzDyarJ6WOEQ9aPfVmrxIqapc4G/XAz1Y3iKOwRK3zjC9KgDwfi/nQtjzauWxrBI698p7LD iuX8f/Y3duHecxKde+czbCnEE8GhcNAELwyZeZBv3lsQbiS8yQJ6A7fx1BWww9ByyLMUOmeOee9 KWBdWAS3aCQp4FYDt8TY7XQ95H2ka8N4ksv+oLUi5eyXQBXZJMAnGBjTv/PR60GkMgVGMMLNRKi NptayKw6dEWeyTXhVXIc53CLklQCAxSOmc+cUgi1ZAhKKHQLK5T08rqCxd051d+f3YBoJ+Pmq4s bNLn+SsXI X-Received: by 2002:a17:906:6da:b0:b8f:a174:3186 with SMTP id a640c23a62f3a-b982f3e783dmr893523566b.57.1774339535104; Tue, 24 Mar 2026 01:05:35 -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> In-Reply-To: From: Xuneng Zhou Date: Tue, 24 Mar 2026 16:05:23 +0800 X-Gm-Features: AQROBzA0Yqtjr81Ot-YiV2-7YTAVwOq2zeXK4763rDMWuKIb4Rt95SnOgk3C3ho Message-ID: Subject: Re: RFC: pg_stat_logmsg To: Michael Paquier Cc: Joe Conway , 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 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 this = 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 do > >> that, but does that require we add the module to contrib? > > > > I had an offlist chat with Andres about this IIRC and he suggested he > > 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 of t= he > > 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, flush_= pending_cb c06e71d1aca (Nov 2024) =E2=80=94 write_to_file flag, enabling opt-in persis= tence 4ba012a8ed9 (Dec 2025) =E2=80=94 to_serialized_data / from_serialized_data = / finish callbacks I=E2=80=99m considering picking this up and 'd like to move it forward. Bef= ore 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. Best, Xuneng