Re: pruning disabled for array, enum, record, range type partitionkeys - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pruning disabled for array, enum, record, range type partitionkeys
Date
Msg-id 20180418214535.j3fo27up3iy5dkvu@alvherre.pgsql
Whole thread Raw
In response to Re: pruning disabled for array, enum, record, range type partition keys  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: pruning disabled for array, enum, record, range type partition keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pruning disabled for array, enum, record, range type partitionkeys  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
Amit Langote wrote:
> On Thu, Apr 19, 2018 at 12:01 AM, Alvaro Herrera
> <alvherre@alvh.no-ip.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.

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.

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

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Should we add GUCs to allow partition pruning to be disabled?
Next
From: Peter Geoghegan
Date:
Subject: Re: WIP: Covering + unique indexes.