Re: How does filter order relate to query optimization?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How does filter order relate to query optimization?
Дата
Msg-id 17590.1172588401@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How does filter order relate to query optimization?  (Andrew Edson <cheighlund@yahoo.com>)
Ответы Re: How does filter order relate to query optimization?  (Andrew Edson <cheighlund@yahoo.com>)
Re: How does filter order relate to query optimization?  ("David Jaquay" <djaquay@gmail.com>)
Список pgsql-general
Andrew Edson <cheighlund@yahoo.com> writes:
> I'm working on a php project that's supposed to draw information from the DB for display, and I've been requested to
speedup the display as much as possible.  I'm drawing data from four tables, with an additional two that I have to
'bounce'through to match the keys together.  Also, I've got five direct filtering requirements, four of the 'value = X'
typeand a date range. 

>   My question is this: Would shuffling the placement of the filtering
> requirements (t1.some_key = t2.some_key and t1.some_other_value = X,
> etc.) make a difference in processing speed for the response time?

No; certainly it will make no difference how you shuffle clauses that
involve different sets of tables.  If you've got clauses that wind up in
the same "Filter:" condition in the generated plan, and some of them
involve expensive functions, it might be useful to shuffle the
expensive-to-evaluate ones to the end.  But in most cases that's just
micro-optimization.  Usually what you want to think about for something
like this is plan optimization, ie, what order are the tables joined in
and with what join methods.  Have you looked at EXPLAIN ANALYZE results
for the query?

            regards, tom lane

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

Предыдущее
От: Jorge Godoy
Дата:
Сообщение: How to debug this crash?
Следующее
От: George Nychis
Дата:
Сообщение: Re: performance of partitioning?