pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Chao Li <li.evan.chao@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: chong.peng@enmotech.com, Lukas Fittl <lukas@fittl.com>
Subject: Re: Fix pg_stat_statements losing normalized query text after reset
Date: Mon, 31 Aug 2026 16:29:42 +0900
Message-ID: <apUtZm9WKscIjkat@paquier.xyz> (raw)
In-Reply-To: <29410A4B-9E7B-4557-A289-B8AB6299707F@gmail.com>
References: <29410A4B-9E7B-4557-A289-B8AB6299707F@gmail.com>

On Mon, Aug 31, 2026 at 03:07:47PM +0800, Chao Li wrote:
> Based on this understanding, I made a fix that resets existing
> entries back to the sticky state rather than deleting them. This
> preserves the normalized query text for cached prepared
> statements. If a query with the same query ID is parsed again later,
> the sticky entry is updated with the newly normalized query
> text. I’m not very familiar with the history and design
> considerations around pg_stat_statements_reset(), so I don’t have
> full confidence that retaining the entries is the intended approach,
> so comments are welcome.

I doubt that this is worth complicating the code of PGSS for.
pg_stat_statements_reset() is used, sure, but the case of a prepared
statement reusing a non-normalized query post-reset feels too edgy for
me to care about.   Let's keep the code simpler.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (2+ messages)

Message-ID: <apUtZm9WKscIjkat@paquier.xyz>
Permalink:  ../apUtZm9WKscIjkat@paquier.xyz/
Also on:    postgresql.org/message-id/apUtZm9WKscIjkat@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, li.evan.chao@gmail.com, lukas@fittl.com
  Subject: Re: Fix pg_stat_statements losing normalized query text after reset
  In-Reply-To: <apUtZm9WKscIjkat@paquier.xyz>
  References: <29410A4B-9E7B-4557-A289-B8AB6299707F@gmail.com> <apUtZm9WKscIjkat@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox