Re: SQL:2003 Window Functions for postgresql 8.3? - Mailing list pgsql-general

From Tom Lane
Subject Re: SQL:2003 Window Functions for postgresql 8.3?
Date
Msg-id 8467.1156445240@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL:2003 Window Functions for postgresql 8.3?  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: SQL:2003 Window Functions for postgresql 8.3?  (Martijn van Oosterhout <kleptog@svana.org>)
Re: SQL:2003 Window Functions for postgresql 8.3?  (Thomas Kellerer <spam_eater@gmx.net>)
Re: SQL:2003 Window Functions for postgresql 8.3?  (Gregory Stark <gsstark@mit.edu>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> The main thing I want to use them for is for cumulative output.
> ...
> With window functions you define for each row a "window" which is from
> the beginning of the table to that row and then sum the values, for
> each row. Then you just divide by the total, nice.

Egad.  Wouldn't that involve O(N) memory and O(N^2) operations?
Perhaps an extremely smart optimizer could improve this using knowledge
of the specific aggregates' behaviors, but for "black box" aggregates
it sounds pretty unworkable.

            regards, tom lane

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: SQL:2003 Window Functions for postgresql 8.3?
Next
From: Ben
Date:
Subject: Re: SQL:2003 Window Functions for postgresql 8.3?