From: | Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
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-11 18:51:43 |
Message-ID: | 202502111851.yfhldozu4c6y@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2025-Feb-11, Dmitry Dolgov wrote:
> > On Tue, Feb 11, 2025 at 10:49:59AM GMT, Sami Imseih wrote:
> > I have only looked at 0001, but I am wondering why
> > query_id_const_merge is a pg_stat_statements GUC
> > rather than a core GUC?
>
> It was moved from being a core GUC into a pg_stat_statements GUC on the request
> from the reviewers. Community tries to prevent adding more and more core GUCs
> into PostgreSQL.
I understand, but I tend to disagree with the argument because it's okay
to simplify things that can be simplified, but if simplifying makes them
more complex, then it goes against the original desire for simplicity
anyway. My impression is that it would be better to put it back.
(Otherwise, how do you document the behavior that pg_stat_activity
suddenly emits different query_ids than before because you installed
pg_stat_statement and enabled this feature? It just doesn't make much
sense.)
> > I suppose this is telling us that detecting the case with consts wrapped
> > in casts is not really optional. (Dmitry said this was supported at
> > early stages of the patch, and now I'm really curious about that
> > implementation because what IsMergeableConstList sees is a FuncExpr that
> > invokes the cast function for float8 to int4.)
>
> Yes, those cases in question are usually FuncExpr. The original patch
> implementation used to handle that via simplifying the node with
> eval_const_expressions to figure out if the value we work with is a constant.
> This approach was marked as too risky by reviewers, as this could reach a lot
> of unexpected functionality in the mutator part.
Hmm, what about doing something much simpler, such as testing whether
there's just a CoerceViaIO/RelabelType around a Const or a one-parameter
function call of an immutable boostrap-OID function that has a Const as
argument, and trivial cases like that? Something very very simple
that's going to catch the majority of cases without anything as complex
as a node walker.
Maybe something like statext_is_compatible_clause_internal() can be an
inspiration (and even that is far more complex than we need here.)
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"If it is not right, do not do it.
If it is not true, do not say it." (Marcus Aurelius, Meditations)
From | Date | Subject | |
---|---|---|---|
Next Message | Álvaro Herrera | 2025-02-11 18:52:33 | Re: pg_stat_statements and "IN" conditions |
Previous Message | Matheus Alcantara | 2025-02-11 18:41:31 | Re: read stream on amcheck |