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

Neil Conway <neilc@samurai.com>

From: Neil Conway <neilc@samurai.com>
To: siracusa@mindspring.com
Cc: Postgres Performance <pgsql-performance@postgresql.org>
Date: 2004-01-05T20:23:16Z
Lists: pgsql-performance
John Siracusa <siracusa@mindspring.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