Preview

Modeling and Analysis of Information Systems

Advanced search

A method for ranking SQL query execution plans based on textual descriptions and vector representation models

https://doi.org/10.18255/1818-1015-2026-2-266-280

Abstract

This paper studies the problem of ranking SQL query execution plans by execution time. We propose a method in which structural encoding of the plan tree is replaced with a textual description of the plan, which is then converted into a vector representation using a vector representation model. A compact prediction model is trained on top of this representation and used to rank plans. Three approaches are compared: the prediction model from Bao, which relies on structural encoding of the plan tree, the cost estimate produced by the PostgreSQL optimizer, and the proposed method based on textual plan descriptions and vector representation models. In addition, several vector representation models and two variants of textual plan description are investigated: the raw plan text and a normalized description. Experiments are conducted on the CEB benchmark built on IMDb data under two evaluation settings: random splits and query-template splits. Quality is evaluated using pairwise accuracy and Spearman correlation. The results show that under random splits, the best configuration based on jina-code-embeddings-0.5b outperforms both the Bao model and the optimizer cost estimate on both ranking metrics. For all considered models, the raw textual plan description is more informative than the normalization scheme used in this work. Under query-template splits, the quality of all learned approaches decreases; in this setting, the best model based on vector representations and the Bao model remain comparable to each other, but both are outperformed by the optimizer cost estimate. These results indicate that textual plan descriptions and vector representation models can serve as a basis for predictive plan-ranking methods, although robust generalization to previously unseen query templates remains an open problem.

About the Author

Nikita K. Vasilenko
Ershov Institute of Informatics Systems SB RAS
Russian Federation


References

1. V. Leis, A. Gubichev, A. Mirchev, P. Boncz, A. Kemper, and T. Neumann, “How Good Are Query Optimizers, Really?,” Proceedings of the VLDB Endowment, vol. 9, no. 3, pp. 204–215, 2015, doi: 10.14778/2850583.2850594.

2. S. Chaudhuri, “An Overview of Query Optimization in Relational Systems,” in Proceedings of the Seventeenth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, Association for Computing Machinery, 1998, pp. 34–43. doi: 10.1145/275487.275492.

3. H. Lan, Z. Bao, and Y. Peng, “A Survey on Advancing the DBMS Query Optimizer: Cardinality Estimation, Cost Model, and Plan Enumeration,” Data Science and Engineering, vol. 6, no. 1, pp. 86–101, 2021, doi: 10.1007/s41019-020-00149-7.

4. K. Kim, J. Jung, I. Seo, W.-S. Han, K. Choi, and J. Chong, “Learned Cardinality Estimation: An In-depth Study,” in Proceedings of the 2022 International Conference on Management of Data, Association for Computing Machinery, 2022, pp. 1214–1227. doi: 10.1145/3514221.3526154.

5. T. Siddiqui, A. Jindal, S. Qiao, H. Patel, and W. Le, “Cost Models for Big Data Query Processing: Learning, Retrofitting, and Our Findings,” in Proceedings of the 2020 ACM SIGMOD International Conference on Management of Data, Association for Computing Machinery, 2020, pp. 99–113. doi: 10.1145/3318464.3380584.

6. M. Akdere, U. Çetintemel, M. Riondato, E. Upfal, and S. B. Zdonik, “Learning-Based Query Performance Modeling and Prediction,” in Proceedings of the 2012 IEEE 28th International Conference on Data Engineering, IEEE Computer Society, 2012, pp. 390–401. doi: 10.1109/ICDE.2012.64.

7. R. Marcus, P. Negi, H. Mao, N. Tatbul, M. Alizadeh, and T. Kraska, “Bao: Making Learned Query Optimization Practical,” in Proceedings of the 2021 International Conference on Management of Data, Association for Computing Machinery, 2021, pp. 1275–1288. doi: 10.1145/3448016.3452838.

8. C. Anneser et al., “AutoSteer: Learned Query Optimization for Any SQL Database,” Proceedings of the VLDB Endowment, vol. 16, no. 12, pp. 3515–3527, 2023, doi: 10.14778/3611540.3611544.

9. L. Woltmann, J. Thiessat, C. Hartmann, D. Habich, and W. Lehner, “FASTgres: Making Learned Query Optimizer Hinting Effective,” Proceedings of the VLDB Endowment, vol. 16, no. 11, pp. 3310–3322, 2023, doi: 10.14778/3611479.3611528.

10. R. Zhu et al., “Lero: A Learning-to-Rank Query Optimizer,” Proceedings of the VLDB Endowment, vol. 16, no. 6, pp. 1466–1479, 2023, doi: 10.14778/3583140.3583160.

11. Z. Yang, W.-L. Chiang, S. Luan, G. Mittal, M. Luo, and I. Stoica, “Balsa: Learning a Query Optimizer Without Expert Demonstrations,” in Proceedings of the 2022 International Conference on Management of Data, ACM, 2022, pp. 931–944. doi: 10.1145/3514221.3517885.

12. Y. Zhao, G. Cong, J. Shi, and C. Miao, “QueryFormer: a tree transformer model for query plan representation,” Proceedings of the VLDB Endowment, vol. 15, no. 8, pp. 1658–1670, 2022, doi: 10.14778/3529337.3529349.

13. Z. Li, H. Yuan, H. Wang, G. Cong, and L. Bing, “LLM-R2: A Large Language Model Enhanced Rule-Based Rewrite System for Boosting Query Efficiency,” Proceedings of the VLDB Endowment, vol. 18, no. 1, pp. 53–65, 2024, doi: 10.14778/3696435.3696440.

14. J. Liu and B. Mozafari, “GenRewrite: Query Rewriting via Large Language Models,” Proceedings of the ACM on Management of Data, vol. 4, no. 1, pp. 1–26, 2026, doi: 10.1145/3786684.

15. S. Dharwada, H. Devrani, J. Haritsa, and H. Doraiswamy, “Query Rewriting via LLMs.” 2025.

16. Y. Song et al., “QUITE: A Query Rewrite System Beyond Rules with LLM Agents.” 2026.

17. P. Siebers, C. Janiesch, and P. Zschech, “A Survey of Text Representation Methods and Their Genealogy,” in IEEE Access, Institute of Electrical and Electronics Engineers (IEEE), 2022, pp. 96492–96513. doi: 10.1109/access.2022.3205719.

18. P. Negi et al., “Flow-loss: learning cardinality estimates that matter,” Proceedings of the VLDB Endowment, vol. 14, no. 11, pp. 2019–2032, 2021, doi: 10.14778/3476249.3476259.


Review

For citations:


Vasilenko N.K. A method for ranking SQL query execution plans based on textual descriptions and vector representation models. Modeling and Analysis of Information Systems. 2026;33(2):266-280. (In Russ.) https://doi.org/10.18255/1818-1015-2026-2-266-280

Views: 53

JATS XML


Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 1818-1015 (Print)
ISSN 2313-5417 (Online)