finding a max value

From: Edoardo Ceccarelli <eddy(at)expot(dot)it>
To: pgsql-performance(at)postgresql(dot)org
Cc: pgsql-admin(at)postgresql(dot)org
Subject: finding a max value
Date: 2004-07-02 18:50:26
Message-ID: 40E5AE72.1080206@expot.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-bugs pgsql-performance

This is the query:
select max(KA) from annuncio

field KA is indexed and is int4,

explaining gives:
explain select max(KA) from annuncio;
QUERY PLAN
-----------------------------------------------------------------------
Aggregate (cost=21173.70..21173.70 rows=1 width=4)
-> Seq Scan on annuncio (cost=0.00..20326.76 rows=338776 width=4)
(2 rows)

wasn't supposed to do an index scan? it takes about 1sec to get the result.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bender, Cheryl 2004-07-02 18:56:52 Re: Dumping partial database content
Previous Message Michael A Nachbaur 2004-07-02 18:31:57 Re: SERIAL type not autoincremented

Browse pgsql-bugs by date

  From Date Subject
Next Message Dario Fassi 2004-07-03 01:14:54 Error in DatabaseMetaData.getColumns() with Views
Previous Message Stephen Frost 2004-07-02 17:02:56 Re: Grant Update (Possible bug)?

Browse pgsql-performance by date

  From Date Subject
Next Message Gaetano Mendola 2004-07-03 14:51:50 Re: BUG #1186: Broken Index?
Previous Message CoL 2004-07-02 14:23:44 Re: Mysterious performance of query because of plsql function in