Efficient Evaluation of Arbitrarily-Framed Holistic SQL Aggregates and Window Functions
Adrian Vogelsgesang, Thomas Neumann, Viktor Leis, Alfons Kemper
Abstract
Window functions became part of the SQL standard in SQL:2003 and are widely used for data analytics: Percentiles, rankings, moving averages, running sums and local maxima are all expressed as window functions in SQL. Yet, the features offered by SQL's window functions lack composability: Framing is only available for distributive and algebraic aggregate functions, but not for holistic aggregates like percentiles and window functions like ranks. The SQL standard explicitly disallows holistic aggregates from being framed and thereby severely limits data analysts. This paper proposes to remove this restriction, thereby making window functions fully composable. The newly gained composability allows for more complex aggregates which are tricky to evaluate. The lack of subquadratic, parallel algorithms to evaluate framed holistic aggregates is probably the main objection against adding truly composable window functionality to the SQL standard. As such, this paper shows how to efficiently evaluate all window and aggregate functions from SQL:2011, except for DENSE_RANK, in combination with arbitrary window frames. This includes framed distinct aggregates, framed value functions, framed percentiles and framed ranks.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get 9fad7f6e-c869-4cc7-9e06-ee2105edfe50Cited by top-tier papers1
Ask how each one uses itRelated papers
- Window Function Optimization: Co-Evaluation and Other TechniquesDaniel Lindner, Felix Naumann, Alberto LernerVLDB 2026
- Building Advanced SQL Analytics From Low-Level Plan OperatorsAndré Kohn, Viktor Leis, Thomas NeumannSIGMOD 2021 · 13 citations
- Efficient Approximation of Certain and Possible Answers for Ranking and Window Queries over Uncertain DataSu Feng, Boris Glavic, Oliver KennedyVLDB 2023 · 1 citation
- Efficient Incremental Computation of Aggregations over Sliding WindowsChao Zhang, Reza Akbarinia, Farouk ToumaniKDD 2021 · 11 citations
- Automated Translation of Functional Big Data Queries to SQLGuoqiang Zhang, Benjamin Mariano, Xipeng Shen, Isil DilligOOPSLA 2023 · 5 citations
