Re: Select max(foo) and select count(*) optimization

From: Neil Conway <neilc(at)samurai(dot)com>
To: siracusa(at)mindspring(dot)com
Cc: Postgres Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Select max(foo) and select count(*) optimization
Date: 2004-01-05 20:23:16
Message-ID: 87k746p2kr.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

John Siracusa <siracusa(at)mindspring(dot)com> writes:
> 1. The query "select max(foo) from bar" where the column foo has an index.
> Aren't indexes ordered? If not, an "ordered index" would be useful in this
> situation so that this query, rather than doing a sequential scan of the
> whole table, would just "ask the index" for the max value and return nearly
> instantly.

http://www.postgresql.org/docs/current/static/functions-aggregate.html

-Neil

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Browne 2004-01-05 20:26:15 Re: Select max(foo) and select count(*) optimization
Previous Message Rod Taylor 2004-01-05 20:14:24 Re: deferred foreign keys