arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2304.04407cs.DB
收藏

COOOL:一种基于 Learning-To-Rank 的 SQL Hint 推荐方法

COOOL: A Learning-To-Rank Approach for SQL Hint Recommendations

Xianghong Xu, Zhibing Zhao, Tieying Zhang, Rong Kang, Luming Sun, Jianjun Chen

AI总结:

针对现有基于回归的 SQL hint 推荐方法在绝对延迟预测和单数据集训练上的局限性,本文提出 COOOL 框架,利用 Learning-To-Rank 预测查询计划相对成本排序,在 PostgreSQL 实验中超越现有方法并支持多数据集统一模型。

摘要:

查询优化是每个数据库管理系统(DBMS)的关键部分,因为它决定了查询执行的效率。许多研究引入了机器学习(ML)技术用于成本建模、基数估计和端到端学习优化器,但由于训练时间长、缺乏可解释性以及集成成本高,其中很少有方法被证明是实用的。最近的一项研究提供了一种通过推荐每查询提示来优化查询的实用方法,但它存在两个固有问题。首先,它遵循回归框架来预测每个查询计划的绝对延迟,这非常具有挑战性,因为某个查询的查询计划延迟可能跨越多个数量级。其次,它需要为每个数据集训练一个模型,这限制了训练模型在实际中的应用。在本文中,我们提出了 COOOL,通过 Learning-To-Rank 预测查询计划的 Cost Orders,以与 DBMS 协作。COOOL 不估计绝对成本,而是使用基于排序的方法来计算查询计划成本的相对排序分数。我们证明了 COOOL 在理论上能够区分具有不同延迟的查询计划。我们在 PostgreSQL 上实现了 COOOL,并且在 join-order-benchmark 和 TPC-H 数据上的大量实验表明,COOOL 在单数据集任务以及多数据集任务的统一模型上均优于 PostgreSQL 和最先进的方法。我们的实验还从表示学习的角度阐明了 COOOL 优于回归方法的原因,这可能会指导未来的研究。

英文摘要:

Query optimization is a pivotal part of every database management system (DBMS) since it determines the efficiency of query execution. Numerous works have introduced Machine Learning (ML) techniques to cost modeling, cardinality estimation, and end-to-end learned optimizer, but few of them are proven practical due to long training time, lack of interpretability, and integration cost. A recent study provides a practical method to optimize queries by recommending per-query hints but it suffers from two inherited problems. First, it follows the regression framework to predict the absolute latency of each query plan, which is very challenging because the latencies of query plans for a certain query may span multiple orders of magnitude. Second, it requires training a model for each dataset, which restricts the application of the trained models in practice. In this paper, we propose COOOL to predict Cost Orders of query plans to cOOperate with DBMS by Learning-To-Rank. Instead of estimating absolute costs, COOOL uses ranking-based approaches to compute relative ranking scores of the costs of query plans. We show that COOOL is theoretically valid to distinguish query plans with different latencies. We implement COOOL on PostgreSQL, and extensive experiments on join-order-benchmark and TPC-H data demonstrate that COOOL outperforms PostgreSQL and state-of-the-art methods on single-dataset tasks as well as a unified model for multiple-dataset tasks. Our experiments also shed some light on why COOOL outperforms regression approaches from the representation learning perspective, which may guide future research.

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

↑