Re: Query times change by orders of magnitude as DB ages

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Query times change by orders of magnitude as DB ages
Дата
Msg-id 603c8f070911251101r4abb015dj8f2146d6364ba7b0@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Query times change by orders of magnitude as DB ages  (Richard Neill <rn214@cam.ac.uk>)
Список pgsql-performance
On Wed, Nov 25, 2009 at 7:27 AM, Richard Neill <rn214@cam.ac.uk> wrote:
> Sergey Aleynikov wrote:
>>
>> Hello,
>>
>>> * Is there any way I can nail the query planner to a particular query
>>> plan,
>>> rather than have it keep changing its mind?
>>
>> All these setting leads to choosing different plans. If you have small
>> number of complex sensitive queires, you can run explain on them with
>> correct settings, then re-order query (joins, subselects) according to
>> given query plan, and, before running it, call
>>
>> set local join_collapse_limit = 1;
>> set local from_collapse_limit = 1;
>
> It's a simple query, but using a complex view. So I can't really re-order
> it.

Almost all queries can be reordered to some degree, but you might have
to inline the view into the main query to actually be able to do it.
Forcing a particular query plan in the manner described here is
generally sort of a last resort, though.  Usually you want to figure
out how to tune things so that the query planner picks the right plan
by itself - that's sort of the point of having a query planner...

...Robert

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: query optimization
Следующее
От: Faheem Mitha
Дата:
Сообщение: Re: query optimization