<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article article-type="research-article" dtd-version="1.3" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="ru"><front><journal-meta><journal-id journal-id-type="publisher-id">mais</journal-id><journal-title-group><journal-title xml:lang="ru">Моделирование и анализ информационных систем</journal-title><trans-title-group xml:lang="en"><trans-title>Modeling and Analysis of Information Systems</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">1818-1015</issn><issn pub-type="epub">2313-5417</issn><publisher><publisher-name>Yaroslavl State University</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.18255/1818-1015-2026-2-266-280</article-id><article-id custom-type="elpub" pub-id-type="custom">mais-2096</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="ru"><subject>Artificial Intelligence</subject></subj-group></article-categories><title-group><article-title>Метод ранжирования планов выполнения SQL-запросов на основе текстового описания и моделей векторных представлений</article-title><trans-title-group xml:lang="en"><trans-title>A method for ranking SQL query execution plans based on textual descriptions and vector representation models</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0009-0003-8727-3000</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Василенко</surname><given-names>Никита Константинович</given-names></name><name name-style="western" xml:lang="en"><surname>Vasilenko</surname><given-names>Nikita K.</given-names></name></name-alternatives><email xlink:type="simple">vasilenko.nikita.research@gmail.com</email><xref ref-type="aff" rid="aff-1"/></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>Институт систем информатики им. А.П. Ершова СО РАН</institution><country>Россия</country></aff><aff xml:lang="en"><institution>Ershov Institute of Informatics Systems SB RAS</institution><country>Russian Federation</country></aff></aff-alternatives><pub-date pub-type="collection"><year>2026</year></pub-date><pub-date pub-type="epub"><day>18</day><month>06</month><year>2026</year></pub-date><volume>33</volume><issue>2</issue><fpage>266</fpage><lpage>280</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Василенко Н.К., 2026</copyright-statement><copyright-year>2026</copyright-year><copyright-holder xml:lang="ru">Василенко Н.К.</copyright-holder><copyright-holder xml:lang="en">Vasilenko N.K.</copyright-holder><license xml:lang="ru" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>Данная работа распространяется под лицензией Creative Commons Attribution 4.0.</license-p></license><license xml:lang="en" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>This work is licensed under a Creative Commons Attribution 4.0 License.</license-p></license></permissions><self-uri xlink:href="https://www.mais-journal.ru/jour/article/view/2096">https://www.mais-journal.ru/jour/article/view/2096</self-uri><abstract><p>В статье рассматривается задача ранжирования планов выполнения SQL-запросов по времени выполнения. Такая задача представляет интерес для интеллектуальной оптимизации запросов, поскольку позволяет оценить, насколько выбранное описание плана сохраняет информацию, связанную с фактической стоимостью его исполнения. Предлагается метод, в котором вместо структурной кодировки дерева плана используется его текстовое описание, для которого затем строится векторное представление с помощью модели векторных представлений. Поверх полученного векторного представления обучается компактная предсказательная модель, используемая для ранжирования планов. В работе сравниваются три подхода: предсказательная модель из подхода Bao, использующая структурную кодировку дерева плана, стоимостная оценка оптимизатора PostgreSQL и предложенный метод на основе текстового описания плана и моделей векторных представлений. Дополнительно исследуются несколько моделей векторных представлений и два варианта текстового описания плана — исходный текст и нормализованное описание. Эксперименты проведены на наборе CEB, построенном на данных IMDb, в двух режимах тестирования: при случайном разбиении и при разбиении по шаблонам запросов. Качество оценивалось по попарной точности и коэффициенту Спирмена. Показано, что при случайном разбиении выборки лучшая конфигурация на основе модели jina-code-embeddings-0.5b превосходит модель Bao и стоимостную оценку оптимизатора по обеим метрикам ранжирования. Установлено также, что исходное текстовое описание плана для всех рассмотренных моделей оказывается более информативным, чем использованная схема нормализации. При разбиении выборки по шаблонам запросов качество всех обучаемых подходов снижается; при этом лучшая модель на основе векторных представлений и модель Bao остаются на сопоставимом уровне между собой, однако по обеим метрикам уступают стоимостной оценке оптимизатора. Полученные результаты показывают, что текстовое описание плана и модели векторных представлений могут использоваться как основа для построения предсказательных моделей ранжирования, хотя проблема устойчивой генерализации на ранее не наблюдавшиеся шаблоны запросов остаётся открытой.</p></abstract><trans-abstract xml:lang="en"><p>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.</p></trans-abstract><kwd-group xml:lang="ru"><kwd>оптимизация SQL-запросов</kwd><kwd>планы выполнения</kwd><kwd>ранжирование планов</kwd><kwd>предсказание времени выполнения</kwd><kwd>векторные представления</kwd></kwd-group><kwd-group xml:lang="en"><kwd>SQL query optimization</kwd><kwd>execution plans</kwd><kwd>plan ranking</kwd><kwd>execution time prediction</kwd><kwd>embeddings</kwd></kwd-group></article-meta></front><back><ref-list><title>References</title><ref id="cit1"><label>1</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit15"><label>15</label><citation-alternatives><mixed-citation xml:lang="ru">S. Dharwada, H. Devrani, J. Haritsa, and H. Doraiswamy, “Query Rewriting via LLMs.” 2025.</mixed-citation><mixed-citation xml:lang="en">S. Dharwada, H. Devrani, J. Haritsa, and H. Doraiswamy, “Query Rewriting via LLMs.” 2025.</mixed-citation></citation-alternatives></ref><ref id="cit16"><label>16</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Song et al., “QUITE: A Query Rewrite System Beyond Rules with LLM Agents.” 2026.</mixed-citation><mixed-citation xml:lang="en">Y. Song et al., “QUITE: A Query Rewrite System Beyond Rules with LLM Agents.” 2026.</mixed-citation></citation-alternatives></ref><ref id="cit17"><label>17</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref><ref id="cit18"><label>18</label><citation-alternatives><mixed-citation xml:lang="ru">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.</mixed-citation><mixed-citation xml:lang="en">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.</mixed-citation></citation-alternatives></ref></ref-list><fn-group><fn fn-type="conflict"><p>The authors declare that there are no conflicts of interest present.</p></fn></fn-group></back></article>
