Re: Indexes slower when used in decending vs. ascending order?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Indexes slower when used in decending vs. ascending order?
Дата
Msg-id 9133.1144779487@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Indexes slower when used in decending vs. ascending order?  (Alasdair Young <ayoung@vigilos.com>)
Ответы Re: Indexes slower when used in decending vs. ascending
Список pgsql-novice
Alasdair Young <ayoung@vigilos.com> writes:
> I am noticing a significant speed difference between the following two
> queries (the one using "ORDER BY clientkey desc, premiseskey desc,
> logtime desc, logkey desc" takes 19 seconds to execute, versus almost
> immediate execution of the "ORDER BY clientkey, premiseskey, logtime,
> logkey") and was wondering if there was anything I could do to make
> execution any faster.

I'd bet that the problem is the "filter" on logicaldel --- is the value
of that heavily correlated with the index ordering?  You could be
scanning through many many rows of the index to reach the first (last)
one with logicaldel = 'N'.

            regards, tom lane

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

Предыдущее
От: Alasdair Young
Дата:
Сообщение: Indexes slower when used in decending vs. ascending order?
Следующее
От: Andre Majorel
Дата:
Сообщение: Curses interface