Factor Windows: Cost-based Query Rewriting for Optimizing Correlated Window Aggregates
Wentao Wu, Philip A. Bernstein, Alex Raizman, Christina Pavlopoulou
Abstract
Window aggregates are ubiquitous in stream processing. In Azure Stream Analytics (ASA), a stream processing service hosted by Microsoft's Azure cloud, we see many customer queries that contain aggregate functions (such as MIN and MAX) over multiple correlated windows (e.g., tumbling windows of length five minutes and ten minutes) defined on the same event stream. In this paper, we present a cost-based optimization framework for optimizing such queries by sharing computation among multiple windows. In particular, we introduce the notion of factor windows, which are auxiliary windows that are not in the input query but may nevertheless help reduce the overall computation cost, and our cost-based optimizer can produce rewritten query plans that have lower costs than the original query plan by utilizing factor windows. Since our optimization techniques are at the level of query (plan) rewriting, they can be implemented on any stream processing system that supports a declarative, SQL-like query language without changing the underlying query execution engine. We formalize the shared computation problem, present the optimization techniques in detail, and report evaluation results over both synthetic and real datasets. Our results show that, compared to the original query plans, the rewritten plans output by our cost-based optimizer can yield significantly higher (up to 16.8×) throughput.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext e6214403-2aa9-4bbe-a2d4-d117d61de512Cited by top-tier papers2
- LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query EfficiencyZhaodonghui Li, Haitao Yuan, Huiming Wang, Gao Cong et al.VLDB 2025 · 52 citations
- Large-Scale Spatiotemporal Kernel Density VisualizationTsz Nam Chan, Pak Lon Ip, Bojian Zhu, Leong Hou U et al.ICDE 2025 · 6 citations
Builds on3
- Grizzly: Efficient Stream Processing Through Adaptive Query CompilationPhilipp M. Grulich, Sebastian Breß, Steffen Zeuch, Jonas Traub et al.SIGMOD 2020 · 41 citations
- LightSaber: Efficient Window Aggregation on Multi-core ProcessorsGeorgios Theodorakis, Alexandros Koliousis, Peter R. Pietzuch, Holger PirkSIGMOD 2020 · 36 citations
- Optimization of Threshold Functions over StreamsWalter Cai, Philip A. Bernstein, Wentao Wu, Badrish ChandramouliVLDB 2021 · 3 citations
Related papers
- SASPAR: Shared Adaptive Stream PartitioningJeyhun Karimov, Hans-Arno JacobsenICDE 2023 · 3 citations
- Window Function Optimization: Co-Evaluation and Other TechniquesDaniel Lindner, Felix Naumann, Alberto LernerVLDB 2026
- Unraveling the Impact of Window Semantics: Optimizing Join Order for Efficient Stream ProcessingAriane Ziehn, Jan Szlang, Steffen Zeuch, Volker MarklVLDB 2025 · 2 citations
- AJoin: Ad-hoc Stream Joins at ScaleJeyhun Karimov, Tilmann Rabl, Volker MarklVLDB 2020 · 14 citations
- New Query Optimization Techniques in the Spark Engine of Azure SynapseAbhishek Modi, Kaushik Rajan, Srinivas Thimmaiah, Prakhar Jain et al.VLDB 2022 · 13 citations
