#Window functions

9 messages · Page 1 of 1 (latest)

tepid kite
#

I have just started learning PostgreSQL so don't judge me. While going through the official documentation, I had this in my way and cannot understand a single thing about window functions. Can anyone explain?

azure cloud
#

Not very well, but window functions allow to define a set of rows (often but not exclusively) like N rows above or below the current row, so that you can then do a group by on just the rows in that sliding window

#

So if you want to say “for every day of sales, show the sum of the previous n days of sales”

shell sage
#

Window functions are for performing aggregations across multiple rows. Unlike a GROUP BY they return a result for every row. Some common applications are cumulative sums or a moving average. In my experience they're more of an advance analysis technique and I rarely encounter them in app development.

tepid kite
shell sage
tepid kite
shell sage
#

Really? I haven't heard that before. But I use it more as a reference, it just has "tutorial" in the name.