发表机构
Microsoft Research(微软研究院)
机构由 AI 辅助整理,请以论文原文为准。AI 中文总结
本文提出一种确定性方法,系统探索优化器代价模型参数空间,保证找到最优查询计划,避免随机搜索或贝叶斯优化的不稳定性,并在PostgreSQL和SQL Server上验证了显著性能提升。
AI 中文摘要
现代查询优化器使用分析代价模型来估计给定查询计划的代价。此类代价模型通常是若干“代价单元”的函数,这些代价单元指定处理一行时的单位CPU代价或访问一个磁盘页时的单位IO代价。传统上,这些代价单元被视为平台相关的常量,也就是说,当数据库部署在某个硬件/软件平台上时,需要进行一次性校准,但此后无论优化何种查询,它们都保持不变。最近的一些工作采取了不同的视角,将这些代价单元视为可调参数,本文中我们称之为“代价模型参数(CMPs)”。然而,迄今为止,还没有任何方法为调优结果提供最优性保证。我们提出了一种新方法,系统地探索由CMPs张成的查询计划空间,并找到执行时间最优的计划。与使用随机搜索(RS)或贝叶斯优化(BO)的替代探索方法相比,我们的新方法是确定性的,因此避免了应用RS或BO时不可避免的不稳定性。此外,它保证能找到查询计划空间中的所有候选计划,而不会遭受穷举枚举的开销。我们还提出了一组优化技术,以减少执行所找到的候选计划所花费的总体评估时间,这一因素常被先前工作忽视,但从实践角度来看至关重要。在PostgreSQL和Microsoft SQL Server上的实验评估证明了调优CMPs的有效性,它能找到执行时间比RS或BO找到的计划快数个数量级的查询计划。
英文摘要
Modern query optimizers use analytical cost models to estimate the cost of a given query plan. Such cost models are typically functions of a set of "cost units" that specify unit CPU cost when processing a row or unit IO cost when accessing a disk page. These cost units are traditionally viewed as platform-dependent constants, that is, they require a one-shot calibration when a database is deployed on a hardware/software platform, but are fixed afterward regardless of the query being optimized for. Some very recent work has taken a different perspective by viewing these cost units as tunable parameters that we call "cost model parameters (CMPs)" in this paper. However, so far there is no approach that offers any optimality guarantee for the tuning results. We present a new approach to systematically explore the query plan space spanned by the CMPs and find the best plan in terms of execution time. Compared to alternative exploration approaches that use random search (RS) or Bayesian optimization (BO), our new approach is deterministic and, therefore, avoids the undesirable instability that is inevitable when applying RS or BO. Moreover, it is guaranteed to find all candidate plans in the query plan space without suffering from the overhead of an exhaustive enumeration. We also present a set of optimization techniques to reduce the overall evaluation time spent on executing the candidate plans found, a factor that is often overlooked by previous work but is critical from a practical point of view. Experimental evaluation on top of PostgreSQL and Microsoft SQL Server demonstrates the efficacy of tuning the CMPs, which can find query plans that are orders of magnitude faster in execution time than the ones found by RS or BO.