Best-N aggregates

Поиск
Список
Период
Сортировка
От Oliver Kennedy
Тема Best-N aggregates
Дата
Msg-id E27AD664-1D82-46C9-A095-3E22F2FF6A44@cs.cornell.edu
обсуждение исходный текст
Список pgsql-general
Hi,

I'm looking to write an aggregate of the form

compute_over_best_n ( A, B )

where I'm trying to compute a value over the first n (where n is data-
dependent) values in the input table, sorted over column A.  Column B
contains supplemental information used to determine n (that is, when
to stop the aggregate).  My first thought was to pass a sortop to
CREATE AGGREGATE, but the fact that I need column B prevents me from
using a sort.  Is there any way to trick postgres into only sorting
over the first parameter, without getting rid of the second?  Thanks.

- Oliver Kennedy

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [ask] Return Query
Следующее
От: Kynn Jones
Дата:
Сообщение: Scanning a large binary field