pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Berg <myon@debian.org>
To: pgsql-hackers@lists.postgresql.org
Cc: Álvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Sami Imseih <samimseih@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Subject: Squash constant lists in query jumbling by default
Date: Tue, 25 Mar 2025 17:28:59 +0100
Message-ID: <Z-LZyygkkNyA8-kR@msg.df7cb.de> (raw)
In-Reply-To: <E1tubCw-0038AS-24@gemulon.postgresql.org>
References: <E1tubCw-0038AS-24@gemulon.postgresql.org>

Re: Álvaro Herrera
> Introduce squashing of constant lists in query jumbling
> 
> pg_stat_statements produces multiple entries for queries like
>     SELECT something FROM table WHERE col IN (1, 2, 3, ...)
> 
> depending on the number of parameters, because every element of
> ArrayExpr is individually jumbled.  Most of the time that's undesirable,
> especially if the list becomes too large.
> 
> Fix this by introducing a new GUC query_id_squash_values which modifies
> the node jumbling code to only consider the first and last element of a
> list of constants, rather than each list element individually.  This
> affects both the query_id generated by query jumbling, as well as
> pg_stat_statements query normalization so that it suppresses printing of
> the individual elements of such a list.
> 
> The default value is off, meaning the previous behavior is maintained.

The "jumble names of temp tables" thread was briefly touching this [1],
I'm starting a new thread since the others are already very long.

[1] https://www.postgresql.org/message-id/flat/CAA5RZ0uNofEXfEfNw3uRN3D3oXkFPQ_s%2BhuLLHMKR_%2BMCk8RPQ%4...

Two points were made:

1) this should be on by default
2) there should be no GUC for it.

For 1), Sami said "Why would anyone not want to squash the IN list?"
to which I can only agree. Michael agreed as well, that's already +3.

For 2), Tom said that configurability is 1) often much less useful
than originally planned, and 2) tools have to cope with both settings
anyway, making implementing them harder. Plus, switching at run-time
makes the result even less predictable.

So, I would propose that we drop the GUC and make it the default.
Opinions?

Christoph





view thread (9+ messages)  latest in thread

Message-ID: <Z-LZyygkkNyA8-kR@msg.df7cb.de>
Permalink:  ../Z-LZyygkkNyA8-kR@msg.df7cb.de/
Also on:    postgresql.org/message-id/Z-LZyygkkNyA8-kR@msg.df7cb.de

 · 

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: myon@debian.org, alvherre@alvh.no-ip.org, samimseih@gmail.com, michael@paquier.xyz, tgl@sss.pgh.pa.us, rjuju123@gmail.com
  Subject: Re: Squash constant lists in query jumbling by default
  In-Reply-To: <Z-LZyygkkNyA8-kR@msg.df7cb.de>
  References: <E1tubCw-0038AS-24@gemulon.postgresql.org> <Z-LZyygkkNyA8-kR@msg.df7cb.de>

* 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