From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: Roman Fail <rfail@posportal.com>
Cc: sszabo@megazone23.bigpanda.com
Cc: pgsql-performance@postgresql.org
Subject: Re: 7.3.1 New install, large queries are slow
Date: Thu, 16 Jan 2003 12:30:09 -0500
Message-ID: <16505.1042738209@sss.pgh.pa.us> (raw)
In-Reply-To: <web-2316163@davinci.ethosmedia.com>
References: <web-2316163@davinci.ethosmedia.com>
"Josh Berkus" <josh@agliodbs.com> writes:
> This could be re-arranged some, but I think you get the idea ... I've
> been able, in some queries, to get the planner to use a better and
> faster join strategy by repeating my WHERE conditions in the JOIN
> criteria.
Hm. It shouldn't be necessary to do that --- the planner should be able
to push down the WHERE conditions to the right place without that help.
The list of explicit JOINs as you have here is a good way to proceed
*if* you write the JOINs in an appropriate order for implementation.
I believe the problem with Roman's original query was that he listed
the JOINs in a bad order. Unfortunately I didn't keep a copy of that
message, and the list archives seem to be a day or more behind...
but at least for these WHERE conditions, it looks like the best bet
would to join m to b (I'm assuming m.merchid is unique), then to t,
then to d, then add on the others.
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, josh@agliodbs.com, rfail@posportal.com, sszabo@megazone23.bigpanda.com
Subject: Re: 7.3.1 New install, large queries are slow
In-Reply-To: <16505.1042738209@sss.pgh.pa.us>
References: <web-2316163@davinci.ethosmedia.com> <16505.1042738209@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