Re: SQL:2003 Window Functions for postgresql 8.3?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: AgentM <agentm(at)themactionfaction(dot)com>, PostgreSQL General ML <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL:2003 Window Functions for postgresql 8.3?
Date: 2006-08-24 18:47:20
Message-ID: 8467.1156445240@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ben 2006-08-24 19:07:48 Re: SQL:2003 Window Functions for postgresql 8.3?
Previous Message Martijn van Oosterhout 2006-08-24 18:37:43 Re: SQL:2003 Window Functions for postgresql 8.3?