{"id":855,"date":"2026-03-08T01:04:32","date_gmt":"2026-03-07T17:04:32","guid":{"rendered":"https:\/\/iweb20wp-b205b.url.tku.edu.tw\/jase\/?post_type=tkuisotope&#038;p=855"},"modified":"2026-03-21T23:57:22","modified_gmt":"2026-03-21T15:57:22","slug":"slq-lightweight-detection-llm-generation-sql-selfoptimization-framework-2","status":"publish","type":"tkuisotope","link":"\/jase\/?tkuisotope=slq-lightweight-detection-llm-generation-sql-selfoptimization-framework-2","title":{"rendered":"SLQ: Lightweight-Detection &amp; LLM-Generation SQL SelfOptimization Framework"},"content":{"rendered":"\n<div class=\"wp-block-tkuwpbs5-bs5-row row article-info\">\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-3 align-self-start\">\n<p><i class=\"fa fa-folder\" aria-hidden=\"true\"><\/i>&nbsp;<a href=\"\/jase\/?page_id=807\" data-type=\"page\" data-id=\"807\">2026<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-3 align-self-start\">\n<p><i class=\"fa fa-folder-open\" aria-hidden=\"true\"><\/i>&nbsp;<a href=\"\/jase\/?page_id=817\" data-type=\"page\" data-id=\"817\">Volume 30<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-6 align-self-start\">\n<div class=\"wp-block-tkuwpbs5-bs5-div dv_publish\" data-aos=\"normal\"><div class=\"wp-block-post-date\"><time datetime=\"2026-03-08T01:04:32+08:00\">2026-03-08<\/time><\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-row row\">\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-5 align-self-start\">\n<div class=\"wp-block-tkuwpbs5-bs5-div au-ol\" data-aos=\"normal\">\n<p>Zhu Tianyou<a href=\"mailto:tianyou-zhu@sgcc.com.cn\"><i class=\"fa fa-envelope\"><\/i><\/a>, Qi Yaru, Jiang Kongchen, Sang Yanting, and Yang Chao<\/p>\n\n\n\n<p style=\"font-size:14px\">State Grid Information &amp; Telecommunication center (Big Data center), Beijing 100052, P. R. China<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-div\" style=\"margin-top:var(--wp--preset--spacing--40)\" data-aos=\"normal\">\n<p>Received:\u00a0October 13, 2025<br>Accepted:\u00a0November 16, 2025<br>Publication Date:\u00a0March 8, 2026<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-column col-md-7 align-self-start\"><img decoding=\"async\" src=\"\/jase\/wp-content\/uploads\/2026\/03\/30_025.jpg\" class=\"img-fluid img-fluid mx-auto d-block\" alt=\"\u4e0a\u50b3\u5716\u7247\">\n\n\n<p class=\"has-text-align-center img_caption\">Schematic Diagram of the SLQ Framework.<\/p>\n<\/div>\n<\/div>\n\n\n\n<p class=\"has-small-font-size\"><i class=\"fab fa-creative-commons\"><\/i>&nbsp;<strong>Copyright&nbsp;<\/strong>The Author(s). This is an open access article distributed under the terms of the&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/creativecommons.org\/licenses\/by\/4.0\/\" target=\"_blank\">Creative Commons Attribution&nbsp;License (CC BY 4.0)<\/a>, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are cited.<\/p>\n\n\n\n<p>Download Citation:\u00a0 <a rel=\"noreferrer noopener\" href=\"\/jase\/wp-content\/uploads\/2026\/01\/jase-202509-28-09-0006.pdf\" data-type=\"link\" data-id=\"\/jase\/wp-content\/uploads\/2026\/01\/jase-202509-28-09-0006.pdf\" target=\"_blank\">RIS<\/a> | <a rel=\"noreferrer noopener\" href=\"\/jase\/wp-content\/uploads\/2026\/01\/jase-202509-28-09-0006.pdf\" data-type=\"link\" data-id=\"\/jase\/wp-content\/uploads\/2026\/01\/jase-202509-28-09-0006.pdf\" target=\"_blank\">BibTeX <\/a>| <a href=\"http:\/\/dx.doi.org\/10.6180\/jase.202607_30.025\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/dx.doi.org\/10.6180\/jase.202607_30.025<\/a>\u00a0\u00a0<\/p>\n\n\n\n<p class=\"btn btn-primary article-btn\"><a href=\"\/jase\/wp-content\/uploads\/2026\/03\/025_2025_1515.pdf\" data-type=\"attachment\" data-id=\"911\" target=\"_blank\" rel=\"noreferrer noopener\">Download PDF<\/a><\/p>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In real-world database applications, SQL statements written by users often create performance bottlenecks because they violate best-practice rules. Traditional rule-based detectors have limited ability to recognize diverse and increasingly irregular statements and are costly to maintain. To address this, we propose SLQ, a two-stage intelligent SQL optimization framework. First, a lightweight stacked-LSTM module pinpoints problematic statements; then a pre-trained large language model, Qwen3, automatically generates explanations for each flaw and offers targeted rewrite suggestions, helping users quickly improve query quality. Evaluated on a standard dataset, SLQ achieves accuracy, precision, recall and F1 of 0.9841, 0.9974, 0.9702 and 0.9836 respectively, demonstrating superior detection and optimization capability and markedly enhancing SQL compliance and execution efficiency.<\/p>\n\n\n\n<p><em>Keywords:\u00a0SQL Query Optimization; Large Language Model (LLM); Long Short-Term Memory(LSTM)<\/em><\/p>\n\n\n\n<div style=\"height:2rem\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-tkuwpbs5-bs5-div ref_ol\" data-aos=\"normal\">\n<ol>\n<li>[1] J. Yuanli, (2005) \u201cOptimization Methods for Database SQL Query Statements&#8221; Ordnance Automation 24(6): 113\u2013114. DOI: 10.3969\/j.issn.1006-1576.2005.06.055.<\/li>\n<li>[2] L. Jiajun and G. Mei, (2022) \u201cResearch and Application of Oracle Query Optimization&#8221; Information Technology and Informatization (1): 57\u201360. DOI: 10.3969\/j.issn.1672-9528.2022.01.016.<\/li>\n<li>[3] Z. Zheng, X. Yukun, J. Chao, et al., (2024) \u201cResearch on Anomaly Detection in Electric Energy Metering Based on Improved Random Forest Algorithm&#8221; Electric Measurement and Instrumentation: 1\u20138.<\/li>\n<li>[4] L. Wei, C. Dongsheng, F. Fuyong, et al., (2024) \u201cResearch on Short-Term Power Load Forecasting Based on DCT-CNN-GRU&#8221; Electric Measurement and Instrumentation: 1\u201311.<\/li>\n<li>[5] S. Jinwei, L. Junni, X. Donghai, et al., (2024) \u201cResearch on Big Data Diagnosis Method for Transformer Condition Abnormality Based on Improved k-medoids Clustering and Carbon Constraint&#8221; Electrical Measurement and Instrumentation: 1\u201310.<\/li>\n<li>[6] H. Dan, Z. Yonggang, L. Shanhua, et al., (2024) \u201cCalculation and Analysis of Theoretical Line Losses in LowVoltage Substations Based on AdaBoost Ensemble Learning Algorithm&#8221; Electrical Measurement and Instrumentation: 1\u20139.<\/li>\n<li>[7] S. Maesaroh, H. Gunawan, A. Lestari, et al., (2022) \u201cQuery optimization in mysql database using index&#8221; International Journal of Cyber and IT Service Management 2(2): 104\u2013110.<\/li>\n<li>[8] S. Palanisamy and P. SuvithaVani. \u201cA survey on RDBMS and NoSQL Databases MySQL vs MongoDB\u201d. In: 2020 international conference on computer communication and informatics (ICCCI). IEEE, 2020, 1\u20137.<\/li>\n<li>[9] M. Malekpour, N. Shaheen, F. Khomh, et al., (2024) \u201cTowards optimizing sql generation via llm routing&#8221; arXiv preprint arXiv:2411.04319:<\/li>\n<li>[10] M. M. Rahman, S. Islam, M. Kamruzzaman, et al., (2024) \u201cAdvanced query optimization in SQL databases for real-time big data analytics&#8221; Academic Journal on Business Administration, Innovation &amp; Sustainability 4(3): 1\u201314.<\/li>\n<li>[11] Y. Du, Z. Cai, and Z. Ding, (2024) \u201cQuery Optimization in Distributed Database Based on Improved Artificial Bee Colony Algorithm&#8221; Applied Sciences 14(2): 846.<\/li>\n<li>[12] A. Uzzaman, M. M. I. Jim, N. Nishat, et al., (2024) \u201cOptimizing SQL databases for big data workloads: techniques and best practices&#8221; Academic Journal on Business Administration, Innovation &amp; Sustainability 4(3): 15\u201329.<\/li>\n<li>[13] V. B. Ramu, (2023) \u201cOptimizing database performance: Strategies for efficient query execution and resource utilization&#8221; International Journal of Computer Trends and Technology 71(7): 15\u201321.<\/li>\n<li>[14] J. Shao, X. Liu, Y. Li, et al., (2015) \u201cDatabase performance optimization for SQL Server based on hierarchical queuing network model&#8221; International Journal of Database Theory and Application 8(1): 187\u2013196.<\/li>\n<li>[15] K. S. Maabreh. \u201cOptimizing Database Query Performance Using Table Partitioning Techniques\u201d. In: 2018 International Arab Conference on Information Technology (ACIT). IEEE, 2018, 1\u20134.<\/li>\n<li>[16] J. Zhang. \u201cResearch on database application performance optimization method\u201d. In: 2016 6th International Conference on Machinery, Materials, Environment, Biotechnology and Computer. Atlantis Press, 2016, 2236\u20132239.<\/li>\n<li>[17] V. K. Myalapalli, T. P. Totakura, and S. Geloth. \u201cAugmenting database performance via SQL tuning\u201d. In: 2015 International Conference on Energy Systems and Applications. IEEE, 2015, 13\u201318.<\/li>\n<li>[18] S. J. Kamatkar, A. Kamble, A. Viloria, et al. \u201cDatabase performance tuning and query optimization\u201d. In: International Conference on Data Mining and Big Data. Springer International Publishing, 2018, 3\u201311.<\/li>\n<li>[19] X. Sun, B. Jiang, and X. He. \u201cDatabase query optimization based on distributed photovoltaic power generation\u201d. In: 2018 2nd IEEE Advanced Information Management, Communicates, Electronic and Automation Control Conference (IMCEC). IEEE, 2018, 2382\u20132386.<\/li>\n<li>[20] C. Anneser, N. Tatbul, D. Cohen, et al., (2023) \u201cAutosteer: Learned query optimization for any sql database&#8221; Proceedings of the VLDB Endowment 16(12): 3515\u20133527.<\/li>\n<\/ol>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"author":3,"template":"wp-custom-template-detail-4-aricles","meta":{"_uag_custom_page_level_css":""},"categories":[12,16,6],"tags":[42],"acf":[],"uagb_featured_image_src":[],"uagb_author_info":{"display_name":"\u6797\u923a\u6db5","author_link":"\/jase\/?author=3"},"uagb_comment_info":0,"uagb_excerpt":"&nbsp;Copyright&nbsp;The Author(s). This is an open access article distributed under the terms of the&nbsp;Creative Commons Attribution&nbsp;License (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are cited. Download Citation:\u00a0 RIS | BibTeX | http:\/\/dx.doi.org\/10.6180\/jase.202607_30.025\u00a0\u00a0 Download PDF In real-world database applications, SQL statements written by users&hellip;","_links":{"self":[{"href":"\/jase\/index.php?rest_route=\/wp\/v2\/tkuisotope\/855"}],"collection":[{"href":"\/jase\/index.php?rest_route=\/wp\/v2\/tkuisotope"}],"about":[{"href":"\/jase\/index.php?rest_route=\/wp\/v2\/types\/tkuisotope"}],"author":[{"embeddable":true,"href":"\/jase\/index.php?rest_route=\/wp\/v2\/users\/3"}],"wp:attachment":[{"href":"\/jase\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/jase\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=855"},{"taxonomy":"post_tag","embeddable":true,"href":"\/jase\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}