Re: Would an index benefit select ... order by?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Would an index benefit select ... order by?
Дата
Msg-id 14070.1194192541@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Would an index benefit select ... order by?  (rihad <rihad@mail.ru>)
Список pgsql-general
rihad <rihad@mail.ru> writes:
> You mean Postgres wouldn't *always* use created_at's index with such
> access patterns on a big table (even if one exists):

> select * from foo order by created_at desc;

No, it wouldn't necessarily, and that's a good thing.  A full-table
indexscan can often be slower than a sort because of inefficient disk
access patterns.  The planner will estimate the cost of each possibility
and pick the one that looks cheaper.

            regards, tom lane

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

Предыдущее
От: Reg Me Please
Дата:
Сообщение: Re: COPY ... FROM and index usage
Следующее
От: Tom Lane
Дата:
Сообщение: Re: COPY ... FROM and index usage