Re: Slow performance on MAX(primary_key)
От | Keith Gray |
---|---|
Тема | Re: Slow performance on MAX(primary_key) |
Дата | |
Msg-id | 3DABC801.8060902@heart.com.au обсуждение исходный текст |
Ответ на | Re: Slow performance on MAX(primary_key) (Ludwig Lim <lud_nowhere_man@yahoo.com>) |
Ответы |
Re: Slow performance on MAX(primary_key)
|
Список | pgsql-sql |
Ludwig Lim wrote: >>I have just been comparing some large table >>performance under 7.1 using the >> >> select max(primary key)from table; >> > > 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. Thanks Ludwig, That does help performance, but I was using a "standard" SQL command wrapped in a VB6 ADO ODBC program. Is this likely to be sorted in 7.2 ? Is anyone looking at this? -- Keith Gray Technical Services Manager Heart Consulting Services
В списке pgsql-sql по дате отправления: