Stay Curious!

Features I'd like in MySQL: windowing functions

Continuing with my wishlist, I’ll add windowing functions. They’re enormously powerful. They allow you to extend relational logic beyond the strict boundaries of tuples. In MySQL at present, one must use ugly hacks to preserve state from one row to the next, such as user variables – which are not guaranteed to work if the optimizer changes the query plan.

And yeah, PostgreSQL and SQL Server have windowing functions too, and once you’ve used them it’s a little hard to go back. This is in fact one of the main things I hear from people who love PostgreSQL for what I consider to be legitimate reasons.

Windowing functions extend the uses of SQL (sometimes awkwardly, sometimes elegantly), into areas you can’t really go without them. Time-series data, for example, or more powerful graph processing. These things must be done externally to SQL otherwise, in ugly procedural logic.

Windowing functions together with CTEs (my previous post) are particularly powerful.

Anyone want to guess what my next wish will be?

Posted on Tue, Sep 10, 2013. Approximately 200 Words.

Databases