Re: Performance woes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Performance woes
Дата
Msg-id 3060.1134432704@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Performance woes  (Benjamin Smith <lists@benjamindsmith.com>)
Ответы Re: Performance woes  (Benjamin Smith <lists@benjamindsmith.com>)
Список pgsql-general
Benjamin Smith <lists@benjamindsmith.com> writes:
> The example that I gave was a small one to illustrate my understanding of
> multiple foreign keys, indexes and how they work together. (or don't) The
> actual query is quite a bit bigger and nastier. I've considered breaking it
> up into smaller pieces, but this query has been extensively tested and
> debugged. It's on a complex schema carefully designed to meet some very
> demanding requirements.

What you probably need to do is rethink the join order.  As coded, the
planner has no freedom to change the join order, which means it's up to
you to get it right.  In particular it seems a bad idea to be processing
the join to enrollments last when that table is the best-constrained
one.  Instead of "enrollments, stmoduleobjass LEFT JOIN lots-o-stuff"
consider "enrollments JOIN stmoduleobjass ON relevant-join-conditions
LEFT JOIN lots-o-stuff".  Likewise for lcregistrations vs lcclasses.

            regards, tom lane

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

Предыдущее
От: Benjamin Smith
Дата:
Сообщение: Re: Performance woes
Следующее
От: vishal saberwal
Дата:
Сообщение: Re: File access problem access(), stat()