Constraint exclusion can't process simple constant expressions? - Mailing list pgsql-performance

From Josh Berkus
Subject Constraint exclusion can't process simple constant expressions?
Date
Msg-id 4DAF70FD.7000609@agliodbs.com
Whole thread Raw
Responses Re: Constraint exclusion can't process simple constant expressions?
List pgsql-performance
All,

Apparently our CE is unable to deal with even moderately complex
expressions.  For example, given a CE check constraint of:

    "chk_start" CHECK (start >= '2011-01-31 00:00:00-05'::timestamp with
time zone AND start < '2011-03-01 00:00:00-05'::timestamp with time zone)

PostgreSQL CE is unable to figure out not to scan this partition for a
query which contains the following filter condition:

         WHERE start >= '2010-11-01'::timestamptz
           AND start < ('2010-11-30'::timestamptz + '1
day'::interval)::timestamptz

Even though it can figure out this one:

         WHERE call_start >= '2010-11-01'::timestamptz
           AND call_start < '2010-12-01'::timestamptz

I understand why now() is a problem for CE, but I'd expect that it could
at least handle a simple expression with immutable outputs.

We need a new form of partitioning ...

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

pgsql-performance by date:

Previous
From: Shaun Thomas
Date:
Subject: Re: postgresql random io test with 2 SSD Kingston V+100 500GB in (software) Raid1
Next
From: Tom Lane
Date:
Subject: Re: Constraint exclusion can't process simple constant expressions?