On Wed, Jan 22, 2025 at 6:15 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Really I'd think the right place to be fixing this is at a higher
> level. Where are the repetitive find_ec_member_matching_expr calls
> coming from?
I'm not aware of the repeated calls for the same child, and I mostly
see it called once for every partition from
prepare_sort_from_pathkeys(). For this case, fixing it at the high
level would require something like MergeAppend building a mapping of
Pathkey -> EM for all its children upfront, then passing this down to
the prepare_sort_from_pathkeys().
The other patch series focuses on this being called from the
generate_join_implied_equalities(). That call site could probably use
the same approach with building a mapping before generating the
partitionwise join paths.