Query optimizers in relational database management systems (RDBMSs) search for execution plans expected to be optimal for a given queries. They use parameter estimates, often inaccurate, and make assumptions that may not hold in practice. Consequently, they may select execution plans that are suboptimal at runtime, when these estimates and assumptions are not valid, which may result in poor query performance. Therefore, query optimizers do not sufficiently support robust query optimization. Recent years have seen a surge of interest in using machine learning (ML) to improve efficiency of data systems and reduce their maintenance overheads, with promising results obtained in the area of query optimization in particular. In this paper, inspired by these advancements, and based on several years of experience of IBM Db2 in this journey, we propose Robust Optimization of Queries, (Roq), a holistic framework that enables robust query optimization based on a risk-aware learning approach. Roq includes a novel formalization of the notion of robustness in the context of query optimization and a principled approach for its quantification and measurement based on approximate probabilistic ML. It also includes novel strategies and algorithms for query plan evaluation and selection. Roq also includes a novel learned cost model that is designed to predict query execution cost and the associated risks and performs query optimization accordingly. We demonstrate experimentally that Roq provides significant improvements to robust query optimization compared to the state-of-the-art.
翻译:关系数据库管理系统(RDBMS)中的查询优化器会搜索预期对给定查询最优的执行计划。它们使用的参数估计通常不准确,且做出的假设在实际中可能不成立。因此,当这些估计和假设无效时,优化器可能选择在运行时非最优的执行计划,从而导致查询性能下降。因此,现有查询优化器无法充分支持鲁棒查询优化。近年来,利用机器学习(ML)提升数据系统效率并降低维护开销的研究兴趣激增,尤其在查询优化领域取得了令人瞩目的成果。受这些进展启发,并结合IBM Db2在此领域多年的经验,本文提出了一种名为Roq(Robust Optimization of Queries)的整体框架,该框架基于风险感知学习方法实现鲁棒查询优化。Roq包含一种在查询优化背景下对鲁棒性的新颖形式化定义,以及基于近似概率ML进行量化与测量的系统化方法。它还提出了用于查询计划评估和选择的新颖策略与算法。此外,Roq设计了一种新型学习成本模型,用于预测查询执行成本及相关风险,并据此执行查询优化。实验结果表明,与现有最优方法相比,Roq在鲁棒查询优化方面实现了显著提升。