From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
Cc: | "Roman Fail" <rfail(at)posportal(dot)com>, sszabo(at)megazone23(dot)bigpanda(dot)com, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: 7.3.1 New install, large queries are slow |
Date: | 2003-01-16 17:30:09 |
Message-ID: | 16505.1042738209@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
"Josh Berkus" <josh(at)agliodbs(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2003-01-16 17:47:02 | Re: 7.3.1 New install, large queries are slow |
Previous Message | Josh Berkus | 2003-01-16 17:28:28 | Re: 7.3.1 New install, large queries are slow |