pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: mischa@ca.sophos.com
Cc: pgsql-performance@postgresql.org
Subject: Re: Bad plan for join to aggregate of join.
Date: Tue, 12 Sep 2006 19:42:30 -0400
Message-ID: <3215.1158104550@sss.pgh.pa.us> (raw)
In-Reply-To: <45071FCC.8090509@ca.sophos.com>
References: <821wqiy0oc.fsf@mid.bfk.de>
	<45071FCC.8090509@ca.sophos.com>

Mischa Sandberg <mischa@ca.sophos.com> writes:
> can PG see that a join on an grouped-by field
> can be pushed down into the query as an indexable filter?

No.  The GROUP BY serves as a partial optimization fence.  If you're
concerned about the speed of this query, I recommend making a different
view in which 'message' is joined inside the GROUP BY.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <3215.1158104550@sss.pgh.pa.us>
Permalink:  ../3215.1158104550@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3215.1158104550@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, mischa@ca.sophos.com
  Subject: Re: Bad plan for join to aggregate of join.
  In-Reply-To: <3215.1158104550@sss.pgh.pa.us>

* 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