Re agregates

Поиск
Список
Период
Сортировка
От Christoph Dalitz
Тема Re agregates
Дата
Msg-id 20030122205747.73018b6d.christoph.dalitz@hs-niederrhein.de
обсуждение исходный текст
Ответы Re: Re agregates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
>
> is there a better way to get the max - 1?
> I could loop through and run the queriy for each customer but the cost
> on ten thousand quesries is rather high also?
>
You can directly get the "max - 1" with "order by desc" and "limit" and "offset".
It's worth a try whether that is faster (I would suspect that it is O(n*log(n))
compared to O(n^2) in your "max from max" query).

Christoph Dalitz

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

Предыдущее
От: "Mike Mascari"
Дата:
Сообщение: Re: Odd subselect in target list behavior WRT aggregation
Следующее
От: Serhiy Levchenko
Дата:
Сообщение: sort by relevance