Re: Suggestion for aggregate function

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Suggestion for aggregate function
Дата
Msg-id 20030117192901.GA3839@wolff.to
обсуждение исходный текст
Ответ на Suggestion for aggregate function  (Greg Stark <gsstark@mit.edu>)
Ответы Re: Suggestion for aggregate function  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
On Fri, Jan 17, 2003 at 13:39:11 -0500, Greg Stark <gsstark@mit.edu> wrote:
> 
> So it would be possible to say for example:
> 
> select min(column1),lookup_min(column1,column2) from tab
> 
> to do the equivalent of:
> 
> select column1,column2 where column1=(select min(column1) from tab) limit 1
> 
> except it would be way more efficient. (Especially if there's an index on
> column1 and postgres were taught to use indexes for min/max, but that's a
> different story.)

The following will be more efficient than your function if there is a usable
index on column1:
select column1,column2 from tab order by column 1 limit 1


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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Suggestion for aggregate function
Следующее
От: Robert Treat
Дата:
Сообщение: Re: Generate user/group sysids from a sequence?