Re: Index Scan Backward Slow

Поиск
Список
Период
Сортировка
От Robert Klemme
Тема Re: Index Scan Backward Slow
Дата
Msg-id mi2319$4ed$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: Index Scan Backward Slow  (David Osborne <david@qcode.co.uk>)
Список pgsql-performance
On 01.05.2015 13:06, David Osborne wrote:
> Simple... that did it... thanks!
>
> dev=> create index on table(code,row_id);
> CREATE INDEX
> Time: 38088.482 ms
> dev=> explain (analyse,buffers)  select row_id as last_row_id from table
> where code='XX' order by row_id desc limit 1;

Just out of curiosity: Is there a particular reason why you do not use

select max(row_id) as last_row_id
from table
where code='XX'

?

Kind regards

    robert


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

Предыдущее
От: David Osborne
Дата:
Сообщение: Re: Index Scan Backward Slow
Следующее
От: Anton Bushmelev
Дата:
Сообщение: optimization join on random value