From: | Oliver Kennedy <okennedy(at)cs(dot)cornell(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Best-N aggregates |
Date: | 2009-03-15 20:25:50 |
Message-ID: | E27AD664-1D82-46C9-A095-3E22F2FF6A44@cs.cornell.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Kynn Jones | 2009-03-15 20:42:24 | Scanning a large binary field |
Previous Message | Tom Lane | 2009-03-15 18:44:28 | Re: [ask] Return Query |