Re: 7.3.1 New install, large queries are slow

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 7.3.1 New install, large queries are slow
Дата
Msg-id 16505.1042738209@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: 7.3.1 New install, large queries are slow  ("Josh Berkus" <josh@agliodbs.com>)
Ответы Re: 7.3.1 New install, large queries are slow  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-performance
"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

В списке pgsql-performance по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: 7.3.1 New install, large queries are slow
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: 7.3.1 New install, large queries are slow