Re: Window functions patch v04 for the September commit fest - Mailing list pgsql-hackers

From Hitoshi Harada
Subject Re: Window functions patch v04 for the September commit fest
Date
Msg-id e08cc0400809020136o69c4713fyd020d440d971ea19@mail.gmail.com
Whole thread Raw
In response to Re: Window functions patch v04 for the September commit fest  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
2008/9/2 Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>:
> Gregory Stark wrote:
>> What would the executor do for a query like
>>
>> SELECT lead(x,1),lead(y,2),lead(y,3)
>>
>> It would not only have to keep a tuplestore to buffer the output but it
>> would
>> have to deal with receiving data from different SRFs at different times.
>> The
>> best approach I can think of would be to keep a tuplestore for each SRF
>> using
>> themas queues, reading old values from the head as soon as they all have
>> at
>> least one new value in them.
>
> Hitoshi solved that creating a separate Window node for each window
> function. So the plan tree for that would look something like:
>
> Window (lead(x,1))
>  Window (lead(y,2))
>    Window (lead(y,3))
>      Seq Scan ...
>
> That keeps the Window node implementation quite simple because it only needs
> to handle one window function at a time.

To say more accurately, one Window node can handle more than one
window function. If it is thought to be the same using equalFuncs
comparing targetlists, some functions are put into one node.

Regards,


-- 
Hitoshi Harada


pgsql-hackers by date:

Previous
From: Stefan Kaltenbrunner
Date:
Subject: Re: Window functions patch v04 for the September commit fest
Next
From: Simon Riggs
Date:
Subject: Re: Window functions patch v04 for the September commit fest