arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2302.06873cs.DBcs.AI
收藏

Lero:一个学习排序查询优化器

Lero: A Learning-to-Rank Query Optimizer

Alibaba Group(阿里巴巴集团);The Chinese University of Hong Kong(香港中文大学);Massachusetts Institute of Technology(麻省理工学院)

Rong Zhu, Wei Chen, Bolin Ding, Xingguang Chen, Andreas Pfadler, Ziniu Wu, Jingren Zhou

摘要:

最近的一系列工作应用机器学习技术来帮助或重建DBMS中基于成本的查询优化器。虽然在一些基准中表现出优越性,但它们的不足之处,例如,不稳定的性能、高训练成本和缓慢的模型更新源于使用机器学习模型预测执行计划的成本或等待时间的固有困难。在本文中,我们介绍了一个学习排序查询优化器,称为Lero,它建立在一个本地查询优化器的顶部,并不断学习,以提高优化性能。关键的观察结果是计划的相对顺序或等级,而不是确切的成本或延迟,对于查询优化就足够了。Lero采用成对的方法来训练分类器,以比较任何两个计划,并告诉哪一个更好。在模型效率和准确性方面,这种二进制分类任务比回归任务更容易预测成本或延迟。Lero不是从头开始构建一个学习优化器,而是旨在利用数十年的数据库智慧并改进本机查询优化器。凭借其非侵入式设计,Lero可以在任何现有DBMS上实现,只需最少的集成工作。我们使用PostgreSQL实现了Lero并展示了其出色的性能。在我们的实验中,Lero在几个基准测试中达到了接近最佳的性能。它将PostgreSQL中本机优化器的计划执行时间减少了70%,将其他学习的查询优化器的计划执行时间减少了37%。同时,Lero不断学习并自动适应查询工作负载和数据变化。

英文摘要:

A recent line of works apply machine learning techniques to assist or rebuild cost-based query optimizers in DBMS. While exhibiting superiority in some benchmarks, their deficiencies, e.g., unstable performance, high training cost, and slow model updating, stem from the inherent hardness of predicting the cost or latency of execution plans using machine learning models. In this paper, we introduce a learning-to-rank query optimizer, called Lero, which builds on top of a native query optimizer and continuously learns to improve the optimization performance. The key observation is that the relative order or rank of plans, rather than the exact cost or latency, is sufficient for query optimization. Lero employs a pairwise approach to train a classifier to compare any two plans and tell which one is better. Such a binary classification task is much easier than the regression task to predict the cost or latency, in terms of model efficiency and accuracy. Rather than building a learned optimizer from scratch, Lero is designed to leverage decades of wisdom of databases and improve the native query optimizer. With its non-intrusive design, Lero can be implemented on top of any existing DBMS with minimal integration efforts. We implement Lero and demonstrate its outstanding performance using PostgreSQL. In our experiments, Lero achieves near optimal performance on several benchmarks. It reduces the plan execution time of the native optimizer in PostgreSQL by up to 70% and other learned query optimizers by up to 37%. Meanwhile, Lero continuously learns and automatically adapts to query workloads and changes in data.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑