pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Antill <james@and.org>
To: Edoardo Ceccarelli <eddy@expot.it>
Cc: pgsql-performance@postgresql.org
Subject: Re: finding a max value
Date: Wed, 07 Jul 2004 15:29:58 -0400
Message-ID: <m37jtf62fd.fsf@code.and.org> (raw)
In-Reply-To: <40E5AE72.1080206@expot.it>
References: <20040702075007.B448FCF4D52@www.postgresql.com>
	<20040702131258.GB25007@wolff.to>
	<40E5AE72.1080206@expot.it>

Edoardo Ceccarelli <eddy@expot.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@and.org
:0:
* ^From: .*james@and\.org
/dev/null



view thread (3+ messages)  latest in thread

Message-ID: <m37jtf62fd.fsf@code.and.org>
Permalink:  ../m37jtf62fd.fsf@code.and.org/
Also on:    postgresql.org/message-id/m37jtf62fd.fsf@code.and.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: james@and.org, eddy@expot.it
  Subject: Re: finding a max value
  In-Reply-To: <m37jtf62fd.fsf@code.and.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox