Training-Free Query Optimization via LLM-Based Plan Similarity
Abstract
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-based Plan Mapping (LLM-PM), 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 21% reduction in query latency. 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.
Fields of Study & Subjects
Advanced Database Systems and Queries
Cloud Computing and Resource Management
Data Quality and Management
Publication details
- Journal / source
- The Bulletin of Irkutsk State University Series Mathematics
- Publisher
- Irkutsk State University
- Volume
- 56
- Pages
- 113–128
- Publication date
- 1 January 2026
- Language
- EN