Re: Partitioned tables - planner wont use indexes

From: paul rivers <rivers(dot)paul(at)gmail(dot)com>
To: kevin kempter <kevin(at)kevinkempterllc(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Partitioned tables - planner wont use indexes
Date: 2008-04-05 01:07:49
Message-ID: 47F6D0E5.2050005@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

kevin kempter wrote:
> Hi List;
>
> Sorry if this is a dupe, my first post never showed up...
>
> I'm having some performance issues with a partitioned table. We have a
> VERY large table that we've partitioned by day.
>

Unfortunately, that is the defined behavior in this case. From 5.9.6 of
the manual:

"Constraint exclusion only works when the query's WHERE clause contains
constants."

[Where the constants are of course your partitioning column(s)]

The best way around this depends mostly on what you're up to. You can
get the min tablename from the catalogs, or you can keep a table of
active partitions that your script which drops off old partitions and
generates new ones can keep updated on the oldest/newest partition
dates. Or some number of other solutions, whatever you find cleanest for
your purposes.

Paul

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Gregory Stark 2008-04-05 01:26:36 Re: Partitioned tables - planner wont use indexes
Previous Message kevin kempter 2008-04-05 00:48:25 Partitioned tables - planner wont use indexes