Re: The usual sequential scan, but with LIMIT !

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: The usual sequential scan, but with LIMIT !
Дата
Msg-id 29692.1094564867@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: The usual sequential scan, but with LIMIT !  (Pierre-Frédéric Caillaud<lists@boutiquenumerique.com>)
Ответы Re: The usual sequential scan, but with LIMIT !  (Pierre-Frédéric Caillaud<lists@boutiquenumerique.com>)
Список pgsql-performance
=?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= <lists@boutiquenumerique.com> writes:
>     suppose I SELECT WHERE topic_id=2 ORDER BY topic_id ASC,id DESC.
>     Postgres does a seq scan, but it could think a bit more and start at
> "first index node which has topic_id>2" (simple to find in a btree) then
> go backwards in the index.

If you write it as
    SELECT WHERE topic_id=2 ORDER BY topic_id DESC,id DESC.
then an index on (topic_id, id) will work fine.  The mixed ASC/DESC
ordering is not compatible with the index.

            regards, tom lane

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

Предыдущее
От: G u i d o B a r o s i o
Дата:
Сообщение: Re: [ADMIN] TOAST tables, cannot truncate
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [ADMIN] TOAST tables, cannot truncate