用大模型嵌入实现零训练查询优化,提升数据库执行效率。
Training-Free Query Optimization via LLM-Based Plan Similarity
- 基于大模型生成执行计划嵌入,无需训练
- 通过邻居投票推荐数据库提示,平均降低21%延迟
- 适合想快速提升查询性能的数据库工程师
大语言模型(LLM)嵌入为数据库查询优化提供了新路径。本文探索预训练执行计划嵌入在不需额外模型训练的情况下指导SQL查询执行的可行性。我们提出LLM-PM框架:对查询默认执行计划进行嵌入,寻找历史执行计划中k个最近邻,通过邻域投票推荐数据库提示集;轻量级一致性检查验证所选提示,必要时启动全提示空间搜索。在OpenGauss上使用JOB-CEB基准测试,LLM-PM实现了平均21%的查询延迟降低。该工作展示了LLM嵌入在提升查询性能方面的实用潜力,并开辟了无需训练、基于嵌入的优化器引导系统的新方向。
原文摘要 · Abstract (English)
Large language model (LLM) embeddings offer a promising new avenue for database query optimization. In this paper, we explore how pre-trained execution plan embeddings can guide SQL query execution without the need for additional model training. We introduce LLM-PM (LLM-based Plan Mapping), a framework that embeds the default execution plan of a query, finds its k nearest neighbors among previously executed plans, and recommends database hintsets based on neighborhood voting. A lightweight consistency check validates the selected hint, while a fallback mechanism searches the full hint space when needed. Evaluated on the JOB-CEB benchmark using OpenGauss, LLM-PM achieves an average speed-up of 21% query latency reduction. This work highlights the potential of LLM-powered embeddings to deliver practical improvements in query performance and opens new directions for training-free, embedding-based optimizer guidance systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。