Window Functions in SQL (2013)
blog.jooq.org
Window Functions in SQL (2013)
1–10 of 36 posts
Re: Window Functions in SQL (2013)
#2https://dveeden.github.io/modern-sql-in-mysql/
(aka "Look, window functions are coming")
Re: Window Functions in SQL (2013)
#3Agreed.
A few years of writing expressive, powerful, performant SQL in big blocks will really change your mental model of data across _all_ languages.
I highly recommend a deep dive into the relational world, and I feel super grateful for the SQL-focused job I held previously. Brought those lessons back with me to both FP and OO.
Re: Window Functions in SQL (2013)
#4It would also be great if windows could be function parameters in Postgres. I like to abstract complicated conditionals and calculations into functions, but it falls down if you're operating over a window.
Re: Window Functions in SQL (2013)
#5Re: Window Functions in SQL (2013)
#6"Modern SQL" feature overview for MySQL + forks: https://dveeden.github.io/modern-sql-in-mysql/ (aka "Look, window functions are coming")
Re: Window Functions in SQL (2013)
#7"Modern SQL" feature overview for MySQL + forks: https://dveeden.github.io/modern-sql-in-mysql/ (aka "Look, window functions are coming")
Re: Window Functions in SQL (2013)
#8This is why any decent columnar/timeseries db has its own often arrish query language to take advantages of ordering information inherent in the data. There is an order in that index and SQL table, you just don't have good tools to access and use it.
This touches on a conversation I was having a couple weeks ago where somebody was saying that column/array storage is purely a backend consideration and don't need to care about it in the front end of the database. That view gets you ugly primitives like LAG/LEAD. Being able to exploit your backend decision is paramount to performance.
Products like Informix or KDB+ just give you full access to the data on and off disk as an array so you ca build complex windowing primitives (and even store them and reuse them later).
(PS: I just find this really funny. KDB+ is probably is the only database I know that literally does streaming analytics on a Raspberry Pi. No joke, the full DB on Linux ARM/Pi. https://kx.com/download/ )
Re: Window Functions in SQL (2013)
#9LAG/LEAD are basically SQL having to give in a little to the timeseries and column db people. It obliterates the set theoretic nature of SQL, and they are dog slow. This is why any decent columnar/timeseries db has its own often arrish query language to take advantages of ordering information inherent in the data. There is an order in that index and SQL table, you just don't have good tools to access and use it. This…
Re: Window Functions in SQL (2013)
#10"Modern SQL" feature overview for MySQL + forks: https://dveeden.github.io/modern-sql-in-mysql/ (aka "Look, window functions are coming")
Similarly, there's plv8 for PostgreSQL
How is that similar? plv8 is a procedural language (javascript) for writing user defined functions.