Re: select max(column) not using index

From: "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at>
To: "mlw" <markw(at)mohawksoft(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: select max(column) not using index
Date: 2002-03-13 21:39:49
Message-ID: 46C15C39FEB2C44BA555E356FBCD6FA4961D7E@m0114.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-03-13 22:00:56 Re: Bug #613: Sequence values fall back to previously chec kpointed
Previous Message Bruce Momjian 2002-03-13 21:39:06 Re: [HACKERS] Additional fixes to ecpg - please apply patch