Re: Quadratic planning time for ordered paths over partitioned tables - Mailing list pgsql-hackers

From Alexander Kuzmenkov
Subject Re: Quadratic planning time for ordered paths over partitioned tables
Date
Msg-id CALzhyqyWZ0izqxO+ctknrx=U_tJOQh-Gjvgj5HsDrbSjD3MjWQ@mail.gmail.com
Whole thread Raw
In response to Re: Quadratic planning time for ordered paths over partitioned tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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.



pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: Invalid index on partitioned table - is this a bug or feature?
Next
From: Andres Freund
Date:
Subject: Re: Pre-allocating WAL files