pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julian Mehnle <julian@mehnle.net>
To: pgsql-performance@postgresql.org
Subject: Re: Bad query plans for queries on partitioned table
Date: Wed, 5 Dec 2007 01:57:25 +0000
Message-ID: <200712050157.30907.julian@mehnle.net> (raw)
In-Reply-To: <8763ze6kku.fsf@oxford.xeocode.com>
References: <200712041944.13543.julian@mehnle.net>
	<200712042027.01921.julian@mehnle.net>
	<8763ze6kku.fsf@oxford.xeocode.com>

Gregory Stark wrote:
> "Julian Mehnle" <julian@mehnle.net> writes:
> > I actually do have constraints on all the partitions, e.g. for week
> > 34: [...]
> >
> > Shouldn't this be enough to give the query planner a clue that it
> > only has to join the "email" and "email_extras" tables' partitions
> > pair-wise, as opposed to cross-joining them?
>
> Ah, well, this falls under "The optimizer is a bit dumb about
> partitioned tables". It only looks at the constraints to compare
> against your WHERE clause. It doesn't compare them against the
> constraints for other tables to see if they're partitioned on the same
> key and therefore can be joined table-by-table.
>
> I want 8.4 to be cleverer in this area but there's a ton of things it
> has to learn.

That would be great.

So there's nothing that can be done about it right now, apart from 
manually combining separate SELECTs for each partition using UNION?

Julian.

Attachments:

  signature.asc (application/pgp-signature, 188B) download

view thread (8+ messages)  latest in thread

Message-ID: <200712050157.30907.julian@mehnle.net>
Permalink:  ../200712050157.30907.julian@mehnle.net/
Also on:    postgresql.org/message-id/200712050157.30907.julian@mehnle.net

 · 

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-performance@postgresql.org
  Cc: julian@mehnle.net
  Subject: Re: Bad query plans for queries on partitioned table
  In-Reply-To: <200712050157.30907.julian@mehnle.net>
  References: <200712041944.13543.julian@mehnle.net> <200712042027.01921.julian@mehnle.net> <8763ze6kku.fsf@oxford.xeocode.com> <200712050157.30907.julian@mehnle.net>

* 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