Abstract
Modern learned query optimizers often face challenges related to performance regressions, high training costs, and database management system (DBMS) lock-in. We present LimeQO, a framework for offline query optimization that models the optimization task as a matrix completion problem. By leveraging the low-rank nature of database workloads, LimeQO employs active learning and matrix completion to identify high-performing execution plans with minimal offline testing. Our evaluation demonstrates that LimeQO can achieve up to a 60% workload speedup with negligible overhead and zero performance regressions.
Introduction
Traditional database query optimizers rely on cost models that can be inaccurate, leading to suboptimal execution plans. While "learned" optimizers aim to address these inaccuracies using machine learning, they often introduce risks such as unpredictable performance regressions and high computational costs for data collection and model training.
To mitigate these issues, offline optimization strategies verify alternative plans on an idle system before deployment. However, the search space for optimal plans is vast, making exhaustive testing infeasible. LimeQO addresses this by strategically selecting which plans to test offline, treating the workload as a recommendation system where query latencies are predicted through matrix completion.
The LimeQO Framework
System Architecture
LimeQO operates alongside a standard DBMS, utilizing both online and offline paths. The online path ensures that only verified or default plans are executed, guaranteeing no performance regressions. The offline path involves an exploration loop where LimeQO suggests plans for execution, measures their performance, and updates its internal models.
Matrix Completion and the Low-Rank Assumption
The core innovation of LimeQO is representing a database workload as a Workload Matrix $W$, where rows correspond to unique queries and columns correspond to optimizer "hints" (e.g., specific configurations or join types). Most entries in this matrix are initially unknown.
LimeQO assumes that this matrix is low-rank, implying that structurally similar queries respond similarly to the same hints. This allows the system to use matrix factorization techniques, such as Alternating Least Squares (ALS), to predict missing latencies.
Active Learning and Censored Observations
To maximize efficiency, LimeQO employs Active Learning. Instead of random testing, it prioritizes plans based on an "expected improvement ratio," focusing on those predicted to offer significant speedups relative to their execution time.
Furthermore, LimeQO handles timeouts as censored data. If a plan execution is terminated after a threshold, the model records that the true latency is at least equal to that threshold. This prevents the model from underestimating the cost of slow plans, a common pitfall in latency prediction.
Evaluation
LimeQO was evaluated on four standard benchmarks: JOB (IMDb), CEB (large-scale JOB), Stack (StackOverflow), and DSB (TPC-DS).
Key Results
- Performance Gains: On the CEB workload, LimeQO reduced total execution time from 3 hours to 1.45 hours after only 1.5 hours of offline exploration.
- Efficiency: The linear version (LimeQO-Linear) is 360x more efficient in terms of computational overhead compared to the neural version (LimeQO-Neural), while still providing substantial benefits.
- Robustness: By verifying every plan offline, LimeQO ensures zero regressions relative to the default DBMS optimizer.
- Adaptability: The system quickly recovers performance following shifts in workload or underlying data distributions.
Conclusion
LimeQO demonstrates that treating query optimization as a matrix completion problem is both effective and efficient. By focusing on offline verification and leveraging low-rank properties, it provides a safe and high-performance alternative to traditional and fully online learned optimizers. Future work includes exploring finer-grained hints and extending the framework to commercial DBMS environments.
Summary updated