pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: paul rivers <rivers.paul@gmail.com>
To: kevin kempter <kevin@kevinkempterllc.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Partitioned tables - planner wont use indexes
Date: Fri, 04 Apr 2008 18:07:49 -0700
Message-ID: <47F6D0E5.2050005@gmail.com> (raw)
In-Reply-To: <B5B9A348-AC8B-46E2-AA64-2627B2CC069F@kevinkempterllc.com>
References: <B5B9A348-AC8B-46E2-AA64-2627B2CC069F@kevinkempterllc.com>

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





view thread (6+ messages)  latest in thread

Message-ID: <47F6D0E5.2050005@gmail.com>
Permalink:  ../47F6D0E5.2050005@gmail.com/
Also on:    postgresql.org/message-id/47F6D0E5.2050005@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: rivers.paul@gmail.com, kevin@kevinkempterllc.com
  Subject: Re: Partitioned tables - planner wont use indexes
  In-Reply-To: <47F6D0E5.2050005@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox