[关键词]
[摘要]
由深度学习驱动的学习型查询优化器正在越来越广泛地受到研究者的关注,这些优化器往往能够取得近似甚至超过传统商业优化器的性能.与传统优化器不同的是,一个成功的学习型优化器往往依赖于足够多的高质量的负载查询作为训练数据.低质量的训练查询会导致学习型优化器在未来的查询上失效.提出了基于强化学习的鲁棒的学习型查询优化器训练框架AlphaQO,提前找到学习型优化器做不好的查询,以提高学习型优化器的鲁棒性.AlphaQO中存在两个重要部分:查询生成器和学习型优化器.查询生成器的目标是生成“难”的查询(传统优化器做得好,但是学习型优化器反而做得不好的查询).学习型优化器利用这些生成的查询进行测试和训练,并提供反馈让查询生成器进行更新.系统迭代交替的运行上述两个部分,分别进行训练.目的在于在提供尽量少的信息和消耗足够小的时间下找到足够多“难”的并且未见的查询给优化器训练,以提高学习型优化器的鲁棒性.实验结果显示:该生成器会提供越来越难的训练查询给学习型优化器;同时,这些查询能够提升学习型优化器的性能.
[Key word]
[Abstract]
Learned database query optimizers, which are typically empowered by (deep) learning models, have attracted significant attention recently, because they can offer similar or even better performance than the state-of-the-art commercial optimizers that require hundreds of expert-hours to tune. A crucial factor of successfully training learned optimizers is training queries. Unfortunately, a good query workload that is sufficient for training learned optimizers is not always available. This study proposes a framework, called AlphaQO, on generating queries for learned optimizers with reinforcement learning (RL). AlphaQO is a loop system that consists of two main components, query generator and learned optimizer. Query generator aims at generating “hard” queries (i.e., those queries that the learned optimizer provides poor estimates). The learned optimizer will be trained using generated queries, as well as providing feedbacks (in terms of numerical rewards) to the query generator. If the generated queries are good, the query generator will get a high reward;otherwise, the query generator will get a low reward. The above process is performed iteratively, with the main goal that within a small budget, the learned optimizer can be trained and generalized well to a wide range of unseen queries. Extensive experiments show that AlphaQO can generate a relatively small number of queries and train a learned optimizer to outperform commercial optimizers. Moreover, learned optimizers need much less queries from AlphaQO than randomly generated queries, in order to well train the learned optimizer.
[中图分类号]
[基金项目]
国家自然科学基金(61925205,61632016);华为和好未来资助项目