Slow performance on MAX(primary_key)

Keith Gray <keith@heart.com.au>

From: Keith Gray <keith@heart.com.au>
To: SQL PostgreSQL <pgsql-sql@postgresql.org>
Date: 2002-10-15T05:01:58Z
Lists: pgsql-sql
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.


It is taking 9 seconds to return this from around 1 million records.
Shouldn't this be an instantaneous lookup?

-- 

Keith Gray
Technical Services Manager
Heart Consulting Services