Understanding Window Functions in Greenplum

The big idea behind window functions is to allow you to process several values of the result set at a time. you see through the window some peer rows and are able to compute a single output value from them, much like when using an aggregate function.

When looking through a window we only see a frame at a time. Its all about the frame.

sachi=# select region, rank() over (W) from sachi.sales WINDOW W as (order by year);

 region | rank 

--------+------

 asia   |    1

 usa    |    2

(2 rows)