Aggify: Lifting the Curse of Cursor Loops using Custom Aggregates
Surabhi Gupta, Sanket Purandare, Karthik Ramachandra
摘要
Loops that iterate over SQL query results are quite common, both in application programs that run outside the DBMS, as well as User Defined Functions (UDFs) and stored procedures that run within the DBMS. It can be argued that set-oriented operations are more efficient and should be preferred over iteration; but from real world use cases, it is clear that loops over query results are inevitable in many situations, and are preferred by many users. Such loops, known as cursor loops, come with huge trade-offs and overheads w.r.t. performance, resource consumption and concurrency.
We present Aggify, a technique for optimizing loops over query results that overcomes these overheads. It achieves this by automatically generating custom aggregates that are equivalent in semantics to the loop. Thereby, Aggify completely eliminates the loop by rewriting the query to use this generated aggregate. This technique has several advantages such as: (i) pipelining of entire cursor loop operations instead of materialization, (ii) pushing down loop computation from the application layer into the DBMS, closer to the data, (iii) leveraging existing work on optimization of aggregate functions, resulting in efficient query plans. We describe the technique underlying Aggify, and present our experimental evaluation over benchmarks as well as real workloads that demonstrate the significant benefits of this technique.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 14 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
引用它的顶会 Paper14
- Fine-Grained Lineage for Safer Notebook InteractionsStephen Macke, Aditya G. Parameswaran, Hongpu Gong, Doris Jung Lin Lee 等VLDB 2021 · 46 次引用
- Procedural Extensions of SQL: Understanding their usage in the wildSurabhi Gupta, Karthik RamachandraVLDB 2021 · 34 次引用
- Babelfish: Efficient Execution of Polyglot QueriesPhilipp Marian Grulich, Steffen Zeuch, Volker MarklVLDB 2022 · 32 次引用
- YeSQL: "You extend SQL" with Rich and Highly Performant User-Defined Functions in Relational DatabasesYannis E. Foufoulas, Alkis Simitsis, Eleftherios Stamatogiannakis, Yannis E. IoannidisVLDB 2022 · 25 次引用
- One WITH RECURSIVE is Worth Many GOTOsDenis Hirn, Torsten GrustSIGMOD 2021 · 19 次引用
相关 Paper
- Building Advanced SQL Analytics From Low-Level Plan OperatorsAndré Kohn, Viktor Leis, Thomas NeumannSIGMOD 2021 · 13 次引用
- A Practical Approach to Groupjoin and Nested AggregatesPhilipp Fent, Thomas NeumannVLDB 2021 · 11 次引用
- The UDFBench Benchmark for General-purpose UDF QueriesYannis Foufoulas, Theoni Palaiologou, Alkis SimitsisVLDB 2025
- Functional-Style SQL UDFs With a Capital 'F'Christian Duta, Torsten GrustSIGMOD 2020 · 11 次引用
- SQL Engines Excel at the Execution of Imperative ProgramsTim Fischer, Denis Hirn, Torsten GrustVLDB 2024 · 3 次引用
