Slow performance on MAX(primary_key)

From: Keith Gray <keith(at)heart(dot)com(dot)au>
To: SQL PostgreSQL <pgsql-sql(at)postgresql(dot)org>
Subject: Slow performance on MAX(primary_key)
Date: 2002-10-15 05:01:58
Message-ID: 3DABA146.7010902@heart.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Brian Blaha 2002-10-15 06:06:03 SQL function triggers
Previous Message Brian Ward 2002-10-15 01:21:37 functions that return a dataset or set of rows