Adaptive Recursive Query Optimization
Preprint
Abstract
Performance-critical industrial applications, including large-scale program, network, and distributed system analyses, are increasingly reliant on recursive queries for data analysis. Yet traditional relational algebra-based query optimization techniques do not scale well to recursive query processing due to the iterative nature of query evaluation, where relation cardinalities can change unpredictably during the course of a single query execution. To avoid error-prone cardinality estimation, adaptive query processing techniques use runtime information to inform query optimization, but these systems are not optimized for the specific needs of recursive query processing. In this paper, we introduce Adaptive Metaprogramming, an innovative technique that shifts recursive query optimization and code generation from compile-time to runtime using principled metaprogramming, enabling dynamic optimization and re-optimization before and after query execution has begun. We present a custom join-ordering optimization applicable at multiple stages during query compilation and execution. Through Carac, we evaluate the optimization potential of Adaptive Metaprogramming and show unoptimized recursive query execution time can be improved by three orders of magnitude and hand-optimized queries by 4x.Keywords
All Related Versions
This publication has 18 references indexed in Scilit:
- MLIR: Scaling Compiler Infrastructure for Domain Specific Computation2021
- Reachability Analysis for AWS-Based Networks2019
- Query optimization through the looking glass, and what we found running the Join Order BenchmarkThe VLDB Journal, 2017
- From Datalog to flix: a declarative language for fixed points on latticesACM SIGPLAN Notices, 2016
- On fast large-scale program analysis in Datalog2016
- A Gentle Introduction to Multi-stage Programming, Part IILecture Notes in Computer Science, 2008
- Adaptive query processing2006
- Generalized algebraic data types and object-oriented programmingACM SIGPLAN Notices, 2005
- What you always wanted to know about Datalog (and never dared to ask)IEEE Transactions on Knowledge and Data Engineering, 1989
- The Ackermann function. a theoretical, computational, and formula manipulative studyBIT Numerical Mathematics, 1971