pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: fburgess@radiantblue.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: Partition performance causing ddl commands to slow down significantly
Date: Fri, 12 Apr 2013 12:45:21 -0700
Message-ID: <51686451.2010501@hogranch.com> (raw)
In-Reply-To: <20130412121002.5a830134ae84016b0174832fdc1a3173.1349262d35.wbe@email11.secureserver.net>
References: <20130412121002.5a830134ae84016b0174832fdc1a3173.1349262d35.wbe@email11.secureserver.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 4/12/2013 12:10 PM, fburgess@radiantblue.com wrote:
> The SQL query should be: select count(*) from dna_strands where cid = 1;

ah.  I suspected as much.    its so hard to analyze problems with 
incorrect information and so easy to make wrong assumptions.

> I  just realize don't think this is not going to work. if for the sake 
> of argument that cid = 1 is much more likely be be found in a more 
> recent partition, any inverse search mechanism in the planner will 
> find that match first but then continue through all of the other 
> partitions, Right? The only way to optimize this is to find some way 
> of adding the partition key date to the where clause.

yeah, pretty much.   all partitions HAVE to be scanned in case there's a 
row with that condition, there's no way of avoiding that.

and yeah, abstraction layers like Hibernate make things even harder to 
manage

btw, I think you said 268 child partitions.  that is, in my experience, 
way too many.   we try and keep partitions under a few dozen even on our 
multi-terabyte tables.   6 months by week is about as far as we go.  
with your 10 year data, I'd probably partition by quarter, or something.



-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

view thread (5+ messages)

Message-ID: <51686451.2010501@hogranch.com>
Permalink:  ../51686451.2010501@hogranch.com/
Also on:    postgresql.org/message-id/51686451.2010501@hogranch.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pierce@hogranch.com, fburgess@radiantblue.com
  Subject: Re: Partition performance causing ddl commands to slow down significantly
  In-Reply-To: <51686451.2010501@hogranch.com>
  References: <20130412121002.5a830134ae84016b0174832fdc1a3173.1349262d35.wbe@email11.secureserver.net> <51686451.2010501@hogranch.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