Re: Partitioning and constraint exclusion

From: Vick Khera <vivek(at)khera(dot)org>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Partitioning and constraint exclusion
Date: 2015-09-07 23:39:47
Message-ID: CALd+dccfs4RrZmXxTxe3ubBpdR=_C+RPGWxo5ghP+jvypCEa0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 7, 2015 at 4:48 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> IIRC ​The planner doesn't understand​
>
> ​overlaps so having a definition of:
>
> IN (1,2,3,4,5); or nearly equivalently = ANY(ARRAY[1,2,3,4,5]))​
>
> and a request for:
>
> IN (1,3,5) / = ANY(ARRAY[1,3,5]) is going to get you nowhere with the
> planner.
>

The partition code does not execute your CHECK condition; it only tests to
see if the query includes it explicitly. For example, if you have a split
on "id % 100 = 59" for a table, then looking for id = 13059 does you no
good; you have to search for "id = 13059 AND id % 100 = 59" to invoke the
table exclusions.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jayadevan M 2015-09-08 04:20:33 Re: Partitioning and constraint exclusion
Previous Message Tom Smith 2015-09-07 21:40:01 jsonb value retrieval performance