Re: Quadratic planning time for ordered paths over partitioned tables

From: Alexander Kuzmenkov <akuzmenkov(at)timescale(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Quadratic planning time for ordered paths over partitioned tables
Date: 2025-01-22 17:57:46
Message-ID: CALzhyqyWZ0izqxO+ctknrx=U_tJOQh-Gjvgj5HsDrbSjD3MjWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 22, 2025 at 6:15 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-01-22 18:00:08 Re: Pre-allocating WAL files
Previous Message Álvaro Herrera 2025-01-22 17:57:11 Re: Invalid index on partitioned table - is this a bug or feature?