From: Tom Lane <tgl@sss.pgh.pa.us>
To: michael.mattox@verideon.com
Cc: SZUCS Gábor <surrano@mailbox.hu>
Cc: pgsql-performance@postgresql.org
Subject: Re: How to optimize monstrous query, sorts instead of using index
Date: Wed, 25 Jun 2003 12:39:37 -0400
Message-ID: <4031.1056559177@sss.pgh.pa.us> (raw)
In-Reply-To: <CJEBLDCHAADCLAGIGCOOOEKHCKAA.michael.mattox@verideon.com>
References: <CJEBLDCHAADCLAGIGCOOOEKHCKAA.michael.mattox@verideon.com>
"Michael Mattox" <michael.mattox@verideon.com> writes:
> It's much slower but I appreciate you taking the time to try. I'm pretty
> new to SQL so I must admin this query is very confusing for me. I'm using
> Java Data Objects (JDO, an O/R mapping framework) but the implementation I'm
> using (Kodo) isn't smart enough to do all the joins efficiently, which is
> why I had to rewrite this query by hand.
It wasn't till I read that :-( that I noticed that you were doing nested
left joins. Fooling with the join order may be your best route to a
solution --- have you read
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=explicit-joins.html
regards, tom lane
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: tgl@sss.pgh.pa.us, michael.mattox@verideon.com, surrano@mailbox.hu
Subject: Re: How to optimize monstrous query, sorts instead of using index
In-Reply-To: <4031.1056559177@sss.pgh.pa.us>
References: <CJEBLDCHAADCLAGIGCOOOEKHCKAA.michael.mattox@verideon.com> <4031.1056559177@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