| От | 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
|
| Список | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера