Re: partition queries hitting all partitions even though check key is specified

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Kevin Kempter <kevink(at)consistentstate(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: partition queries hitting all partitions even though check key is specified
Date: 2009-09-02 15:59:01
Message-ID: 1251907141.8406.12.camel@jd-desktop.unknown.charter.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, 2009-09-02 at 09:39 -0600, Kevin Kempter wrote:

> >
> > You sure you remembered those fiddly little casts everywhere?
> > (Frankly, declaring "time" as integer and not timestamp here strikes
> > me as utter lunacy.) What PG version are you using?
> >
> > regards, tom lane
>

As far as I know constraint exclusion doesn't work with date_part or
extract().

The following caveats apply to constraint exclusion:

* Constraint exclusion only works when the query's WHERE clause
contains constants. A parameterized query will not be optimized,
since the planner cannot know which partitions the parameter
value might select at run time. For the same reason, "stable"
functions such as CURRENT_DATE must be avoided.

http://www.postgresql.org/docs/8.3/static/ddl-partitioning.html

Or did I miss something?

Joshua D. Drake

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2009-09-02 17:23:06 Re: partition queries hitting all partitions even though check key is specified
Previous Message Wei Zheng 2009-09-02 15:39:25 Looking for real configuration data