«THE BULLETIN OF IRKUTSK STATE UNIVERSITY». SERIES «MATHEMATICS»
«IZVESTIYA IRKUTSKOGO GOSUDARSTVENNOGO UNIVERSITETA». SERIYA «MATEMATIKA»
ISSN 1997-7670 (Print)
ISSN 2541-8785 (Online)

List of issues > Series «Mathematics». 2026. Vol 56

Training-Free Query Optimization via LLM-Based Plan Similarity

Author(s)

Nikita K. Vasilenko1, Alexander V. Demin1, Vladimir S. Burlakov2

Ershov Institute of Informatics Systems, Novosibirsk, Russian Federation

Lomonosov Moscow State University, Moscow, Russian Federation

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.
About the Authors

Nikita K. Vasilenko, Postgraduate, Ershov Institute of Informatics Systems SB RAS, Novosibirsk, 630090, Russian Federation, vasilenko.nikita.research@gmail.com

Alexander V. Demin, Cand. Sci. (Phys.-Math.), Ershov Institute of Informatics Systems SB RAS, Novosibirsk, 630090, Russian Federation, alexandredemin@yandex.ru,

Vladimir S. Burlakov, Research Scientist, MSU Research Center for Artificial Intelligence, 119991, Moscow, Russian Federation, vladimir.boorlakov@gmail.com

For citation
Vasilenko N. K., Demin A. V., Burlakov V. S. Training-Free Query Optimization via LLM-Based Plan Similarity. The Bulletin of Irkutsk State University. Series Mathematics, 2026, vol. 56, pp. 113–128. https://doi.org/10.26516/1997-7670.2026.56.113
Keywords
query optimization, LLM for databases, database hints
UDC
004.657:004.8
MSC
68P15, 68T07
DOI
https://doi.org/10.26516/1997-7670.2026.56.113
References
  1. Akioyamen P., Yi Z., Marcus R. The Unreasonable Effectiveness of LLMs for Query Optimization. arXiv e-prints, Nov. 2024, arXiv:2411.02862.
  2. Ivanov O., Bartunov S. Adaptive query estimation. arXiv e-prints, Nov. 2017, arXiv:1711.08330.
  3. Kipf A., Kipf T., Radke B., Leis V., Boncz P., Kemper A. Learned Cardinalities: Estimating Correlated Joins with Deep Learning. arXiv e-prints, Sept. 2018, arXiv:1809.00677.
  4. Li Z., Yuan H., Wang H., Cong G., Bing L. LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiency. arXiv e-prints, Apr. 2024, arXiv:2404.12872.
  5. Marcus R., Negi P., Mao H., Zhang C., Alizadeh M., Kraska T., Papaemmanouil O., Tatbul N. Neo: a learned query optimizer. Proc. VLDB Endowment, 2019, vol. 12, pp. 1705–1718.
  6. Negi P., Marcus R., Kipf A., Mao H., Tatbul N., Kraska T., Alizadeh M. Flow-loss: learning cardinality estimates that matter. Proc. VLDB Endowment, 2021, vol. 14, pp. 2019–2032.
  7. Tan J., Zhao K., Li R., Yu J., Piao C., Cheng H., Meng H., Zhao D., Rong Y. Can Large Language Models Be Query Optimizer for Relational Databases? arXiv e-prints, Feb. 2025, arXiv:2502.05562.
  8. Vasilenko N. K, Demin A. V, Ponomaryov D. K Adaptive Cost Model for Query Optimization. The Bulletin of Irkutsk State University. Series Mathematics, 2025, vol. 52, pp. 137–152. https://doi.org/10.26516/1997-7670.2025.52.137
  9. Woltmann L., Hartmann C., Thiele M., Habich D., Lehner W. Cardinality estimation with local deep learning models. Proceedings of the second international workshop on exploiting artificial intelligence techniques for data management, 2019, pp. 1–8.
  10. Woltmann L., Thiessat J., Hartmann C., Habich D., Lehner W. FASTgres: Making Learned Query Optimizer Hinting Effective. Proc. VLDB Endowment, 2023, vol. 16, pp. 3310–3322.
  11. Xu X., Zhao Z., Zhang T., Kang R., Sun L., Chen J. Coool: A learning-to-rank approach for sql hint recommendations. arXiv e-prints, Apr. 2023, arXiv:2304.04407.
  12. Zhu R., Chen W., Ding B., Chen X., Pfadler A., Wu Z., Zhou J. Lero: A learning-to-rank query optimizer. Proc. VLDB Endowment, 2023, vol. 16, pp. 1466–1479.

Full text (english)