Re: Partial join

From: Arne Roland <A(dot)Roland(at)index(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Guo <riguo(at)pivotal(dot)io>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Partial join
Date: 2019-08-01 16:29:21
Message-ID: 563d1a984c2c41b5b126318aafceab11@index.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Uh ... why? The pushed-down restrictions should result in pruning
> away any prunable partitions at the scan level, leaving nothing for
> the partitionwise join code to do.

It seems reasonable to me that the join condition can no longer be verified, since 'sc.sl = sg.sl' is now replaced by 'sg.sl = 5' so the join condition can no longer be validated.

It's true that the pruning would prune everything but one partition, in case we'd just have a single column partition key. But we don't. I don't see how pruning partitions should help in this case, since we are left with multiple partitions for both relations.

Regards
Arne

________________________________
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Sent: Thursday, August 1, 2019 4:14:54 PM
To: Richard Guo
Cc: Arne Roland; pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Partial join

Richard Guo <riguo(at)pivotal(dot)io> writes:
> For the third query, a rough investigation shows that, the qual 'sl =
> 5' and 'sc.sl = sg.sl' will form an equivalence class and generate two
> implied equalities: 'sc.sl = 5' and 'sg.sl = 5', which can be pushed
> down to the base rels. One consequence of the deduction is when
> constructing restrict lists for the joinrel, we lose the original
> restrict 'sc.sl = sg.sl', and this would fail the check
> have_partkey_equi_join(), which checks if there exists an equi-join
> condition for each pair of partition keys. As a result, this joinrel
> would not be considered as an input to further partitionwise joins.

> We need to fix this.

Uh ... why? The pushed-down restrictions should result in pruning
away any prunable partitions at the scan level, leaving nothing for
the partitionwise join code to do.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shay Rojansky 2019-08-01 16:33:52 Re: UCT (Re: pgsql: Update time zone data files to tzdata release 2019a.)
Previous Message Robert Haas 2019-08-01 16:23:42 Re: tableam vs. TOAST

Browse pgsql-performance by date

  From Date Subject
Next Message Andres Freund 2019-08-01 17:21:28 Re: PSQL performance - TPS
Previous Message Tom Lane 2019-08-01 14:14:54 Re: Partial join