Re: apply_scanjoin_target_to_paths and partitionwise join

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, arne(dot)roland(at)malkut(dot)net, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, Richard Guo <guofenglinux(at)gmail(dot)com>
Subject: Re: apply_scanjoin_target_to_paths and partitionwise join
Date: 2025-01-02 21:32:09
Message-ID: CA+TgmoaZtwMJmLi23ajiFCqkjYSXdWzw5o=h+eEitqjpzjepWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 2, 2025 at 3:58 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I am wondering if the problem is not that the plan is slower, it's
> that for some reason the planner took a lot longer to create it.
> It's very plausible that partitionwise planning takes longer, and
> maybe we have some corner cases where the time is O(N^2) or worse.

That doesn't seem like a totally unreasonable speculation, but it
seems a little surprising that retaining the non-partitionwise paths
would fix it. True, that might let us discard a bunch of partitionwise
paths more quickly than would otherwise be possible, but I wouldn't
expect that to have an impact as dramatic as what Jakub alleged. The
thing I thought about was whether there might be some weird effects
with lots of empty partitions; or maybe with some other property of
the path like say sort keys or parallelism. For example if we couldn't
generate a partitionwise path with sort keys as good as the
non-partitionwise path had, or if we couldn't generate a parallel
partitionwise path but we could generate a parallel non-partitionwise
path. As far as I knew neither of those things are real problems, but
if they were then I believe they could pretty easily explain a large
regression.

> However, this is pure speculation without a test case, and any
> proposed fix would be even more speculative. I concur with your
> bottom line: we should insist on a public test case before deciding
> what to do about it.

Yeah.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-01-02 21:35:26 Re: Fwd: Re: A new look at old NFS readdir() problems?
Previous Message Robert Haas 2025-01-02 21:19:44 Re: magical eref alias names