| От | Ludwig Lim |
|---|---|
| Тема | Re: Slow performance on MAX(primary_key) |
| Дата | |
| Msg-id | 20021015071628.57518.qmail@web80304.mail.yahoo.com обсуждение исходный текст |
| Ответ на | Slow performance on MAX(primary_key) (Keith Gray <keith@heart.com.au>) |
| Список | pgsql-sql |
Hi Keith: --- Keith Gray <keith@heart.com.au> wrote: > Help, > > I have just been comparing some large table > performance > under 7.1 using the > > select max(primary key)from table; > > We are using this for various functions including > sequence. > Try using the following as alternative : SELECT primary_key FROM table ORDER BY primary_key desc LIMIT 1; This should work if primary_key is indexes. As of now, Max() doesn't utilizes the indices hence it always do a sequential scan. Hope that helps, regards, ludwig. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера