Search Postgresql Archives

Best-N aggregates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux