Introduction
Database performance is fundamentally tied to index selection, a task traditionally reserved for Database Administrators (DBAs). However, as workloads become more dynamic—shifting between heavy analytical reads (OLAP) and frequent transactional writes (OLTP) in Hybrid Transactional/Analytical Processing (HTAP) environments—static offline tuning tools struggle to keep up. Existing automated solutions often rely on fallible query optimizer cost models and lack the safety guarantees required for production deployment. This paper proposes a "self-driving" approach using contextual multi-armed bandits (MAB) that learns from direct performance observations, providing provable "no-regret" guarantees.
Methodology: Index Selection as a Bandit Problem
The authors frame the index selection challenge as a Contextual Combinatorial Bandit problem. In this framework, each potential index is treated as an "arm," and a specific set of indices (a configuration) is a "super-arm." The system balances exploration (testing new index configurations) with exploitation (utilizing known high-performing indices) using a modified version of the $C^2UCB$ (Contextual Combinatorial Upper Confidence Bound) algorithm.
Unlike traditional tools that treat indices as opaque identifiers, this approach employs Context Engineering. By using features such as column prefixes and statistical metadata, the model can generalize its learning. For instance, if the system discovers that an index on columns (A, B) improves performance, it can infer that an index on (A, B, C) might also be beneficial. This global weight sharing allows the system to converge on optimal configurations without needing to test every possible combination.
The Focused Update Mechanism
A significant innovation introduced in this work is the Focused Update mechanism. Standard bandit updates treat the reward as a single scalar value. In contrast, the focused update decomposes the performance gain into specific components, such as data scan improvements versus index creation overhead.
By updating specific segments of the internal weight vector based on these decomposed rewards, the bandit achieves much faster convergence than traditional methods. This efficiency is critical for adapting to rapidly changing workloads in real-time. Furthermore, the authors provide a corrected regret analysis, mathematically proving that the system's average performance will converge to an optimal policy over time, offering a "safety net" for production environments.
Evaluation and Results
The framework was rigorously tested against state-of-the-art commercial tuning tools and Deep Reinforcement Learning (DRL) agents across industry-standard benchmarks, including TPC-H, TPC-DS, and the CH-BenCHmark for HTAP workloads.
Key findings include:
- Analytical Performance: The MAB approach outperformed commercial tools by up to 75% and DRL-based agents by 58% in dynamic analytical environments.
- HTAP Resilience: In hybrid settings, the bandit successfully balanced the trade-off between read acceleration and write overhead. It achieved up to a 59% speed-up over commercial tools while often using significantly less memory (up to 83% less) by selecting leaner, more efficient index sets.
- Robustness: By measuring actual execution times rather than relying on optimizer estimates, the system remained performant even when faced with skewed data distributions that typically mislead traditional cost models.
Conclusion
By shifting from "what-if" cost models to direct observation through contextual multi-armed bandits, this research provides a robust, self-driving solution for database index tuning. While future work may explore integrating workload forecasting and automated round-size tuning, the current framework demonstrates that provable guarantees and high performance can coexist in complex, modern database environments.
Summary updated