Re: select max(id) from aTable is very slow

Поиск
Список
Период
Сортировка
От David Teran
Тема Re: select max(id) from aTable is very slow
Дата
Msg-id 125FCD10-60AC-11D8-B420-000A95A6F0DC@cluster9.com
обсуждение исходный текст
Ответ на Re: select max(id) from aTable is very slow  (Nick Barr <nicky@chuckie.co.uk>)
Список pgsql-performance
Hi Nick,

>> Try using:
>>
>> SELECT id FROM theTable ORDER BY is DESC LIMIT 1;
>>
>> Using COUNT, MAX, MIN and any aggregate function on the table of that
>> size will always result in a sequential scan. There is currently no
>> way around it although there are a few work arounds. See the
>> following for more information.
>>
>> http://archives.postgresql.org/pgsql-performance/2004-01/msg00045.php
>> http://archives.postgresql.org/pgsql-performance/2004-01/msg00054.php
>> http://archives.postgresql.org/pgsql-performance/2004-01/msg00059.php
>>


thanks, that works fine! I will read the mail archive before asking
such things again ;-)

cheers David


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

Предыдущее
От: Nick Barr
Дата:
Сообщение: Re: select max(id) from aTable is very slow
Следующее
От: "Saleem Burhani Baloch"
Дата:
Сообщение: Slow response of PostgreSQL