Re: pg_stat_statements and "IN" conditions

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Sergei Kornilov <sk(at)zsrv(dot)org>, yasuo(dot)honda(at)gmail(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, smithpb2250(at)gmail(dot)com, vignesh21(at)gmail(dot)com, michael(at)paquier(dot)xyz, nathandbossart(at)gmail(dot)com, stark(dot)cfm(at)gmail(dot)com, geidav(dot)pg(at)gmail(dot)com, marcos(at)f10(dot)com(dot)br, robertmhaas(at)gmail(dot)com, david(at)pgmasters(dot)net, pgsql-hackers(at)postgresql(dot)org, pavel(dot)trukhanov(at)gmail(dot)com, Sutou Kouhei <kou(at)clear-code(dot)com>
Subject: Re: pg_stat_statements and "IN" conditions
Date: 2025-02-12 19:48:03
Message-ID: sxlb7ftpomzzhdoigjflnya7az3utoo4rf5jnk54wst7imqywe@zxkuyhcq4njb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Wed, Feb 12, 2025 at 07:39:39PM GMT, Álvaro Herrera wrote:
> The nastiness level of this seems quite low, compared to what happens to
> this other example if we didn't handle these easy cases:
>
> create table t (a float);
> select i from t where i in (1, 2);
> select i from t where i in (1, '2');
> select i from t where i in ('1', 2);
> select i from t where i in ('1', '2');
> select i from t where i in (1.0, 1.0);

Yep, the current version I've got so far produces the same
pg_stat_statements entry for all of those queries. I'm going to move out
the renamed GUC and post the new patch tomorrow.

> If I understand what you're saying, it's that the extra parenthesis
> cause the recorded query text be a little uglier (but the queryid still
> ends up being one and the same for all queries), which seems much less
> of a problem.

Right, that's correct. After thinking a bit more I think this ugliness
could be addressed easier, if we take into account that all of that is
happening withing a list of elements with more or less strict format.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matheus Alcantara 2025-02-12 19:53:46 Re: dblink: Add SCRAM pass-through authentication
Previous Message Andres Freund 2025-02-12 19:43:29 Re: Allow io_combine_limit up to 1MB