| From: | James Antill <james(at)and(dot)org> |
|---|---|
| To: | Edoardo Ceccarelli <eddy(at)expot(dot)it> |
| Cc: | pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: finding a max value |
| Date: | 2004-07-07 19:29:58 |
| Message-ID: | m37jtf62fd.fsf@code.and.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin pgsql-bugs pgsql-performance |
Edoardo Ceccarelli <eddy(at)expot(dot)it> writes:
> 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.
This is a known misfeature of max() in postgresql, see...
http://archives.postgresql.org/pgsql-performance/2003-12/msg00283.php
--
# James Antill -- james(at)and(dot)org
:0:
* ^From: (dot)*james(at)and\(dot)org
/dev/null
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rosser Schwarz | 2004-07-07 20:27:19 | Re: [PERFORM] finding a max value |
| Previous Message | Michael Adler | 2004-07-07 18:27:30 | Re: Problems upgrading to 7.4 |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Stehule | 2004-07-07 19:38:39 | Re: Can't join on null values |
| Previous Message | Peter Eisentraut | 2004-07-07 19:25:52 | Re: UNIQUE not honoured for NULL |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rosser Schwarz | 2004-07-07 20:27:19 | Re: [PERFORM] finding a max value |
| Previous Message | Missner, T. R. | 2004-07-07 19:28:15 | Re: inserting into brand new database faster than old database |