From: | Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru> |
---|---|
To: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
Cc: | Ivan Kush <ivan(dot)kush(at)tantorlabs(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Subject: | Re: Replace IN VALUES with ANY in WHERE clauses during optimization |
Date: | 2025-01-09 13:10:51 |
Message-ID: | f2faa7a5-979c-4367-bcf7-bdbe2a05a397@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi!
On 04.10.2024 12:05, Andrei Lepikhov wrote:
> We also have an implementation of VALUES -> ARRAY transformation.
> Because enterprises must deal with users' problems, many of these
> users employ automatically generated queries.
> Being informed very well of the consensus about that stuff, we've
> designed it as a library. But, looking into the code now, I see that
> it only needs a few cycles if no one 'x IN VALUES' expression is
> presented in the query. Who knows? It may be OK for the core.
> So, I've rewritten the code into the patch - see it in the attachment.
>
> The idea is quite simple - at the same place as
> convert_ANY_sublink_to_join, we can test the SubLink on proper VALUES
> RTE and perform the transformation if it's convertible.
I updated the patch due to the problem with the coercion types for both
sides of the expression.
We must find a common type for both leftop of the expression and rightop
including constants for correct transformation, and at the same time
check that the resulting types are compatible.
To do this we find an operator for the two input types if it is
possible, and also remember the target types for the left and right
sides, and after that make a coercion.
This processing is only needed in cases where we are not working with
parameters since the final type is not specified for the parameters.
--
Regards,
Alena Rybakina
Postgres Professional
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Add-an-implementation-of-the-x-IN-VALUES-to-x-ANY.patch | text/x-patch | 36.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2025-01-09 13:35:42 | Re: why there is not VACUUM FULL CONCURRENTLY? |
Previous Message | Dean Rasheed | 2025-01-09 13:08:00 | Re: Virtual generated columns |