From: | Sami Imseih <samimseih(at)gmail(dot)com> |
---|---|
To: | Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Julien Rouhaud <rjuju123(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-03-03 17:25:53 |
Message-ID: | CAA5RZ0vt29Om+tKFOcUNhXV+kKpNnj0yj6OFho3-wngcMHWnAQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > > It's not a question about whether it's possible to implement this,
> > > but about whether it makes sense. In case of plain constants it's
> > > straightforward -- they will not change anything meaningfully and
> > > hence could be squashed from the query. Now for a function, that
> > > might return different values for the same set of constant
> > > arguments, it's much less obvious and omitting such expressions
> > > might have unexpected consequences.
> >
> > query jumbling should not care about the behavior of the function. If
> > we take a regular call to a volatile function, we will generate the
> > same queryId for every call regardless of the input to the function.
> > Why does the in-list case need to care about the volatility of the
> > function?
>
> I feel quite insecure about this idea TBH. At least with immutable
> functions I don't expect the system to behave wildly different than with
> actual constants. What non-immutable functions do you have in mind that
> would be useful to fold as if they were constants in the IN list in such
> a query?
I don't have an example of non-immutable functions that should be folded,
but I also don't think query jumbling should care about the
function's volatility at all.
When dealing with FuncExpr, Why can't we simply skip merging when
func->funcformat != COERCE_IMPLICIT_CALL and the arguments
to the function are not constants? Meaning that anytime we have either
explicit casts or explicit function calls, this makes the list not eligible
for merging. See the attached .txt file to demonstrate what I am thinking.
This attached passes all the v28 test cases, but we will need to add tests
for implicit casts and external parameters.
--
Sami
Attachment | Content-Type | Size |
---|---|---|
isMergeableConst.txt | text/plain | 678 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Sami Imseih | 2025-03-03 17:35:15 | Re: Doc: clarify possibility of ephemeral discrepancies between state and wait_event in pg_stat_activity |
Previous Message | Melanie Plageman | 2025-03-03 17:18:37 | Re: Trigger more frequent autovacuums of heavy insert tables |