Re: select max(column) not using index - Mailing list pgsql-hackers

From Zeugswetter Andreas SB SD
Subject Re: select max(column) not using index
Date
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA4961D7E@m0114.s-mxs.net
Whole thread Raw
In response to select max(column) not using index  (Thomas Zehetbauer <thomasz@hostmaster.org>)
List pgsql-hackers
> select max(foo) from bar where x = 'y';
>
> How is the index used in this query?

Informix would use an index created on (x, foo) and I guess others too.

But I too usually find the "select first 1 * from y order by x desc" much more
useful than an optimized max, since it can also return other columns from that row
(And is more performant than an optimally optimized subselect for this).

Andreas


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] Bug #613: Sequence values fall back to previously chec kpointed
Next
From: mlw
Date:
Subject: Re: Transaction on start of session ?