QueryGuide: 基于生成式模型的细粒度查询提示推荐方法
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

TP311

基金项目:

国家自然科学基金(62372034)


QueryGuide: Fine-grained Query Hint Recommendation Method via Generative Model
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    慢查询是指执行时间超过数据库系统所设定的阈值, 从而影响整体性能的查询. 由于开发人员经验不足及查询接口模板缺乏灵活性, 慢查询在应用程序中频繁出现, 成为数据库故障的主要原因. 为了提速慢查询, 数据库管理员通常会进行人工修复, 但是在数据量较大的情况下效率较低, 因此针对慢查询的自动重写方法的研究显得尤为重要. 查询提示是用于显式控制数据库优化器决策的调优指令, 可以通过影响访问路径等策略来改善查询性能. 查询提示推荐作为数据库查询重写领域的重要研究问题, 已经得到广泛关注. 然而, 目前基于机器学习的提示推荐方法仍面临粒度较粗、依赖人工指定候选集等问题. 针对这些问题, 提出基于生成式模型的细粒度提示推荐框架QueryGuide, 通过探索不同细粒度提示的最优组合方式, 来提升重写语句的物理计划执行效率. 具体而言, 该框架一方面基于生成式语言模型探寻推荐策略, 在数据库环境中探索提示对慢查询性能的提升, 并将其作为奖励用于模型微调, 从而生成表级别的细粒度提示; 另一方面提出使用生成式模型推荐的细粒度提示作为探索方向, 并通过扩展得到提示组合. 将组合的探索结果用于模型微调, 可以使模型学习不同提示组合对慢查询重写性能的影响, 从而获得最佳提示组合. 在多个数据集上的实验结果表明, 相较于其他基线算法, QueryGuide方法表现出更好的重写性能, 显著改善了查询时间.

    Abstract:

    A slow query refers to a query whose execution time exceeds the threshold defined by the database system, thus degrading overall performance. Due to limited developer experience and inflexible query interface templates, slow queries frequently occur in applications and are a major cause of database failures. To accelerate slow queries, database administrators often perform manual tuning. However, manual tuning is inefficient for large volumes of data, making research on automatic query rewriting methods for slow queries particularly important. Query hints are tuning directives that explicitly influence optimizer decisions and can improve query performance by affecting strategies such as access paths. As an important research problem in the field of database query rewriting, query hint recommendation has received widespread attention. However, existing machine learning-based hint recommendation methods still face issues such as coarse granularity and reliance on manually specified candidate sets. To address these issues, this study proposes QueryGuide, a fine-grained hint recommendation framework based on a generative model. By exploring the optimal combinations of different fine-grained hints, the execution efficiency of physical plans for rewritten queries is improved. Specifically, on the one hand, the framework explores recommendation strategies based on generative language models, investigates the performance improvement of hints on slow queries in database environments, and uses it as rewards for model fine-tuning, thus generating fine-grained, table-level hints. On the other hand, the fine-grained hints recommended by the generative model are used as exploration directions, and hint combinations are obtained through expansion. The exploration results of these combinations are used for model fine-tuning, enabling the model to learn the impact of different hint combinations on slow query rewriting performance and to identify the optimal hint combination. Experimental results on multiple datasets demonstrate that, compared with other baseline algorithms, the proposed method exhibits better rewriting performance and significantly reduces query execution time.

    参考文献
    相似文献
    引证文献
引用本文

杨少聪,王宁. QueryGuide: 基于生成式模型的细粒度查询提示推荐方法.软件学报,,():1-18

复制
相关视频

分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2025-07-05
  • 最后修改日期:2025-11-10
  • 录用日期:
  • 在线发布日期: 2026-06-10
  • 出版日期:
文章二维码
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号