Re: pruning disabled for array, enum, record, range type partition keys

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pruning disabled for array, enum, record, range type partition keys
Date: 2018-04-19 10:22:19
Message-ID: 31fbe145-2438-2b9d-1e09-1276770c893b@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

On 2018/04/19 6:45, Alvaro Herrera wrote:
> Amit Langote wrote:
>> On Thu, Apr 19, 2018 at 12:01 AM, Alvaro Herrera
>> <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
>>> Makes sense. Still, I was expecting that pruning of hash partitioning
>>> would also work for pseudotypes, yet it doesn't.
>>
>> It does?
>
> Aha, so it does.
>
> While staring at this new code, I was confused as to why we didn't use
> the commutator if the code above had determined one. I was unable to
> cause a test to fail, so I put that thought aside.

Oops, you're right. Shouldn't have ignored the commutator.

> Some time later, after restructuring the code in a way that seemed to
> make more sense to me (and saving one get_op_opfamily_properties call
> for the case of the not-equals operator), I realized that with the new
> code we can store the opstrategy in the PartClause instead of leaving it
> as Invalid and look it up again later, so I did that. And lo and
> behold, the tests that used commutators started failing! So I fixed
> that one in the obvious way, and the tests work fully again.
>
> Please give this version another look. I also rewrote a couple of
> comments.

Thanks, your rewritten version looks much better.

> I now wonder if there's anything else that equivclass.c or indxpath.c
> can teach us on this topic.

I have referenced indxpath.c number of times when writing this code (for
example, match_clause_to_indexcol), but never equivclass.c.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-04-19 10:37:13 Toast issues with OldestXmin going backwards
Previous Message Kyotaro HORIGUCHI 2018-04-19 10:03:02 Re: Oddity in tuple routing for foreign partitions