On 25/8/2023 14:39, Yuya Watari wrote:
> Hello,
>
> On Wed, Aug 9, 2023 at 8:54 PM David Rowley <[email protected]> wrote:
>> I think the best way to move this forward is to explore not putting
>> partitioned table partitions in EMs and instead see if we can
>> translate to top-level parent before lookups. This might just be too
>> complex to translate the Exprs all the time and it may add overhead
>> unless we can quickly determine somehow that we don't need to attempt
>> to translate the Expr when the given Expr is already from the
>> top-level parent. If that can't be made to work, then maybe that shows
>> the current patch has merit.
>
> Based on your suggestion, I have experimented with not putting child
> EquivalenceMembers in an EquivalenceClass. I have attached a new
> patch, v20, to this email. The following is a summary of v20.
Working on self-join removal in the thread [1] nearby, I stuck into the
problem, which made an additional argument to work in this new direction
than a couple of previous ones.
With indexing positions in the list of equivalence members, we make some
optimizations like join elimination more complicated - it may need to
remove some clauses and equivalence class members.
For changing lists of derives or ec_members, we should go through all
the index lists and fix them, which is a non-trivial operation.
[1]
https://www.postgresql.org/message-id/flat/64486b0b-0404-e39e-322d-0801154901f3%40postgrespro.ru
--
regards,
Andrey Lepikhov
Postgres Professional