agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Sergei Kornilov <sk@zsrv.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Marcos Pegoraro <marcos@f10.com.br>
Cc: vignesh C <vignesh21@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: David Steele <david@pgmasters.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Greg Stark <stark@mit.edu>
Cc: Pavel Trukhanov <pavel.trukhanov@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: pg_stat_statements and "IN" conditions
Date: Thu, 9 Feb 2023 18:26:51 +0100
Message-ID: <20230209172651.cfgrebpyyr72h7fv@alvherre.pgsql> (raw)
In-Reply-To: <20230209151226.nwt56axfcu5y3wpr@ddolgov.remote.csb>

On 2023-Feb-09, Dmitry Dolgov wrote:

> > On Thu, Feb 09, 2023 at 02:30:34PM +0100, Peter Eisentraut wrote:

> > What is the point of making this a numeric setting?  Either you want
> > to merge all values or you don't want to merge any values.
> 
> At least in theory the definition of "too many constants" is different
> for different use cases and I see allowing to configure it as a way of
> reducing the level of surprise here.

I was thinking about this a few days ago and I agree that we don't
necessarily want to make it just a boolean thing; we may want to make it
more complex.  One trivial idea is to make it group entries in powers of
10: for 0-9 elements, you get one entry, and 10-99 you get a different
one, and so on:

# group everything in a single bucket
const_merge_threshold = true / yes / on 

# group 0-9, 10-99, 100-999, 1000-9999
const_merge_treshold = powers

Ideally the value would be represented somehow in the query text. For
example

                         query                            | calls
----------------------------------------------------------+-------
 select * from test where i in ({... 0-9 entries ...})    |     2
 select * from test where i in ({... 10-99 entries ...})  |     1

What do you think?  The jumble would have to know how to reduce all
values within each power-of-ten group to one specific value, but I don't
think that should be particularly difficult.


-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Find a bug in a program, and fix it, and the program will work today.
Show the program how to find and fix a bug, and the program
will work forever" (Oliver Silfridge)





view thread (155+ messages)  latest in thread

Message-ID: <20230209172651.cfgrebpyyr72h7fv@alvherre.pgsql>
Permalink:  ../20230209172651.cfgrebpyyr72h7fv@alvherre.pgsql/
Also on:    postgresql.org/message-id/20230209172651.cfgrebpyyr72h7fv@alvherre.pgsql

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, 9erthalion6@gmail.com, peter.eisentraut@enterprisedb.com, sk@zsrv.org, michael@paquier.xyz, marcos@f10.com.br, vignesh21@gmail.com, robertmhaas@gmail.com, zyu@yugabyte.com, david@pgmasters.net, stark@mit.edu, pavel.trukhanov@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: pg_stat_statements and "IN" conditions
  In-Reply-To: <20230209172651.cfgrebpyyr72h7fv@alvherre.pgsql>

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

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