From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Daniel Begin <jfd553(at)hotmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: FW: Constraint exclusion in partitions |
Date: | 2015-05-22 17:51:07 |
Message-ID: | CAKFQuwahY0_9+bX0rVkmE-+qVQD0Qose-CTWprR_AOW19k7=qg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, May 22, 2015 at 10:21 AM, Daniel Begin <jfd553(at)hotmail(dot)com> wrote:
> But how constraint exclusion would react with the following queries …
>
> b- Select * from parent_table where id between 2345 and 6789; --
> using a range of ids
>
Not sure...
These are constants but I'm not sure how smart the planner is about
figuring out inequalities of this form.
I would guess yes but it should be easy enough to confirm this yourself
using explain...you already have the tables.
> c- Select * from parent_table where id in(select ids from
> anothertable); -- using a list of ids from a select
>
Definitely no...
Constraint exclusion is done by the planner before data is read so there is
no possible way for data in a table to be used.
As for performance the only way to know for sure is to test your usage
patterns and data. Even without constraint exclusion partitioning can
provide benefits.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Stefan Stefanov | 2015-05-22 21:02:42 | Re: About COPY command (and probably file fdw too) |
Previous Message | Daniel Begin | 2015-05-22 17:21:25 | FW: Constraint exclusion in partitions |