Re: [HACKERS] path toward faster partition pruning

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Beena Emerson <memissemerson(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] path toward faster partition pruning
Date: 2018-02-28 10:14:51
Message-ID: CAFjFpReQY0QrGLKXke-Hh4ALT8vDVOYOc74S3po89i8TaS5Ltg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 28, 2018 at 6:42 AM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> On 2018/02/28 1:05, Robert Haas wrote:
>> On Mon, Feb 26, 2018 at 10:59 PM, Amit Langote
>> <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>>> You may say that partition bounds might have to be different too in this
>>> case and hence partition-wise join won't occur anyway, but I'm wondering
>>> if the mismatch of partcollation itself isn't enough to conclude that?
>>
>> Yeah, you're right. I think that this is just a bug in partition-wise
>> join, and that the partition scheme should just be using partcollation
>> instead of parttypcoll, as in the attached.
>
> Ah, OK. I was missing that there is no need to have both parttypcoll and
> partcollation in PartitionSchemeData, as the Vars in rel->partexprs are
> built from a bare PartitionKey (not PartitionSchemeData), and after that
> point, parttypcoll no longer needs to kept around.

Yes. That's right.

>
> I noticed that there is a typo in the patch.
>
> + memcpy(part_scheme->partcollation, partkey->parttypcoll,
>
> s/parttypcoll/partcollation/g
>
> BTW, should there be a relevant test in partition_join.sql? If yes,
> attached a patch (partitionwise-join-collation-test-1.patch) to add one.

A partition-wise join path will be created but discarded because of
higher cost. This test won't see it in that case. So, please add some
data like other tests and add command to analyze the partitioned
tables. That kind of protects from something like that.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2018-02-28 11:25:47 Re: [HACKERS] path toward faster partition pruning
Previous Message Amit Langote 2018-02-28 09:24:27 Re: ON CONFLICT DO UPDATE for partitioned tables