Re: extending ORDER BY make query much slower

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: extending ORDER BY make query much slower
Дата
Msg-id 29647.1047506458@sss.pgh.pa.us
обсуждение исходный текст
Ответ на extending ORDER BY make query much slower  ("Dan Langille" <dan@langille.org>)
Ответы Re: extending ORDER BY make query much slower  (Dan Langille <dan@langille.org>)
Список pgsql-sql
"Dan Langille" <dan@langille.org> writes:
> I've found that adding another field to the ORDER BY clause, times go 
> through the roof.

Why does that surprise you?  The original query is using an index to
achieve the required ordering, so it can give you the first 100 rows
without bothering to compute the remainder.  The modified query has to
actually compute all the rows, and sort them, before it knows which are
the first 100.

If you had an index matching the second ORDER BY clause, you'd probably
get a plan similar to the first case.
        regards, tom lane


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

Предыдущее
От: Tomasz Myrta
Дата:
Сообщение: Re: "hide" values in a column
Следующее
От: Tom Lane
Дата:
Сообщение: Re: View - Join based on dis-similar data types