| От | Tom Lane |
|---|---|
| Тема | Re: [SQL] Usage of index in "ORDER BY" operations |
| Дата | |
| Msg-id | 18588.943723082@sss.pgh.pa.us обсуждение |
| Ответ на | Usage of index in "ORDER BY" operations (Matthias Ackermann <matt@webcraft.ch>) |
| Список | pgsql-sql |
Matthias Ackermann <matt@webcraft.ch> writes:
> So it seems that inserting a WHERE-clause, even if it doesn't do
> anything at all (i.e. doesn't reduce the result-set),
> is necessary to force the DB to make use of the index.
This is true in 6.5: it never even considers an indexscan plan unless
there is a WHERE clause that could make use of the index. 7.0 will
be smarter. (Current CVS sources already know about making an indexscan
plan with no other purpose than to satisfy an ORDER BY; in fact they are
probably *too* eager to make use of an index, and will pick that method
even when a linear scan and explicit sort would be faster. I need to
rejigger the cost estimates to be more realistic, especially by taking
LIMIT into account.)
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера