Re: using max() aggregate

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема Re: using max() aggregate
Дата
Msg-id 20000616101317.C6451@styx
обсуждение исходный текст
Ответ на Re: using max() aggregate  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: using max() aggregate
Список pgsql-general
On Fri, Jun 16, 2000 at 02:05:53AM -0400, Tom Lane wrote:
> Louis-David Mitterrand <cunctator@apartia.ch> writes:
> > I am trying to return the most recently updated record from a table:
> > SELECT max(stopdate) FROM auction;
> > and this works but only returns the timestamp, however if I try to get
> > another column with the aggregate it fails:
>
> Perhaps
>
> select * from auction order by stopdate desc limit 1;
>
> In 7.0 this should even be pretty quick, if you have an index on
> stopdate.

Thanks, yours seems to be the best solution.

The performance hit between max() and ORDER BY should be roughly
comparable?

--
Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.fr

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Performance for indexes on functions
Следующее
От: mikeo
Дата:
Сообщение: Re: coalesce view error