From: | Steve Atkins <steve(at)blighty(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org list" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Constraint exclusion and overlapping range checks |
Date: | 2013-09-07 04:54:14 |
Message-ID: | 8F9D3A8E-B993-4C3F-B5B5-9C9E3FF1896B@blighty.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sep 6, 2013, at 9:37 PM, François Beausoleil <francois(at)teksol(dot)info> wrote:
>
> Le 2013-09-07 à 00:29, Steve Atkins a écrit :
>
>> If I have a partitioned table that has some range constraints that look kinda like they're intended for constraint exclusion, but aren't quite non-overlapping, will that break anything?
>>
>> e.g.
>>
>> create table jan ( …, check(created >= '2013-01-01' and created < '2013-02-01'), check(id >=0 and id < 10000100) ) inherits(foo);
>> create table feb ( …, check(created >= '2013-02-01' and created < '2013-03-01'), check(id >=1000000 and id < 20000100) ) inherits(foo);
>> create table mar ( …, check(created >= '2013-03-01' and created < '2013-04-01'), check(id >=2000000 and id < 30000100) ) inherits(foo);
>>
>> Querying by created should be fine, and take advantage of constraint exclusion, but will querying by id work? And if it does work, will it take any advantage of those constraints at all, or just search all the child partitions?
>
> I don't know, but I suspect a quick EXPLAIN ANALYZE will tell you, even with empty tables.
Explain suggests it'll work fine, and make good use of the constraints to prune partitions from the plan. But the docs are pretty specific about overlapping range constraints being a bad thing so I'm wondering if there's potential for problems.
Cheers,
Steve
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2013-09-07 08:32:06 | Re: Constraint exclusion and overlapping range checks |
Previous Message | François Beausoleil | 2013-09-07 04:37:00 | Re: Constraint exclusion and overlapping range checks |