Window Function Optimization: Co-Evaluation and Other Techniques
摘要
Window functions are among the most expressive features of modern SQL. Surprisingly, relatively little has been written about their optimization. Some techniques exist, such as pushing predicates through a window under ideal conditions, but known optimizations no longer apply when those conditions are even slightly unmet. We show that these limitations are not fundamental, but persist because a reasoning framework for window function optimization has been missing. We provide such a framework, introducing techniques we call Frame Analysis, Partition Analysis, and a new execution strategy called Co-Evaluation. These clarify when and how optimizations can be applied. Co-Evaluation, in particular, allows early evaluation of predicates even when they depend on the window function's result. We present each technique and organize the results as a table of algebraic equivalences for window functions. We test these optimizations in an open-source engine, where they never hurt performance and make certain common queries up to 40.7× faster, with larger tables yielding larger gains.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
它引用的 Paper2
相关 Paper
- Efficient Evaluation of Arbitrarily-Framed Holistic SQL Aggregates and Window FunctionsAdrian Vogelsgesang, Thomas Neumann, Viktor Leis, Alfons KemperSIGMOD 2022
- Building Advanced SQL Analytics From Low-Level Plan OperatorsAndré Kohn, Viktor Leis, Thomas NeumannSIGMOD 2021 · 13 次引用
- PLAQUE: Automated Predicate Learning at Query TimeYiming Lin, Sharad MehrotraSIGMOD 2024 · 2 次引用
- Factor Windows: Cost-based Query Rewriting for Optimizing Correlated Window AggregatesWentao Wu, Philip A. Bernstein, Alex Raizman, Christina PavlopoulouICDE 2022 · 4 次引用
- Conjunctive Queries with ComparisonsQichen Wang, Ke YiSIGMOD 2022 · 13 次引用
