Slow performance on MAX(primary_key) - Mailing list pgsql-sql

From Keith Gray
Subject Slow performance on MAX(primary_key)
Date
Msg-id 3DABA146.7010902@heart.com.au
Whole thread Raw
Responses Re: Slow performance on MAX(primary_key)
List 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



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Stored procedure returning row or resultset
Next
From: Brian Blaha
Date:
Subject: SQL function triggers