{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2025,9,17]],"date-time":"2025-09-17T03:16:28Z","timestamp":1758078988402,"version":"3.44.0"},"reference-count":34,"publisher":"Association for Computing Machinery (ACM)","issue":"12","content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. VLDB Endow."],"published-print":{"date-parts":[[2025,8]]},"abstract":"<jats:p>Effectively rewriting a wide range of complex and diverse queries is critical for database systems. Huawei GaussDB has been experiencing limited extensibility of its existing query rewriter. The problem is rooted in the need for one-size-fits-all rewrites by its pipelined rewrite workflow and the source code-level coupling of rewrite logic. This makes it not only difficult to identify generic, broadly applicable rewrites but also engineering-intensive to program them into the system.<\/jats:p>\n          <jats:p>This paper presents GRewriter, GaussDB's new bolt-on extensible query rewriter powered by automated rewrite rule discovery. GRewriter sits atop the existing optimizer stack to explore useful rewrites, allowing a variety of rules to coexist and be selected on a per-query basis. A new rule language, G-DSL, is used to express rewrite rules so that the rewrite engine is not coupled with specific rules. To improve rewrite efficiency, a new rule index structure and a rewrite history cache are introduced. Rules in GRewriter are produced by an offline rule generator. With novel enumeration techniques and a new equivalence theorem, our rule generator can efficiently discover formally verified rules that are much more expressive than prior research prototypes. For operational convenience, GRewriter also supports manual rule authoring and interactive management of rules through familiar SQL interfaces.<\/jats:p>\n          <jats:p>GRewriter has been integrated into GaussDB and is gradually rolling out to customers. GRewriter equips GaussDB with over a hundred rules while maintaining negligible overhead (&lt;1%). These new rewrite rules have enhanced query performance for two key customer applications, an ERP system and a Banking transaction system, reducing production query latency by up to 99.9%\u2014from 26 seconds to just 17 milliseconds.<\/jats:p>","DOI":"10.14778\/3750601.3750622","type":"journal-article","created":{"date-parts":[[2025,9,16]],"date-time":"2025-09-16T13:38:05Z","timestamp":1758029885000},"page":"4991-5003","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":0,"title":["GRewriter: Practical Query Rewriting with Automatic Rule Set Expansion in GaussDB"],"prefix":"10.14778","volume":"18","author":[{"given":"Zhe","family":"Jiang","sequence":"first","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Zhaoguo","family":"Wang","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Haoning","family":"Lan","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Chuzhe","family":"Tang","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Haoran","family":"Ding","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Lefeng","family":"Wang","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Songyun","family":"Zou","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Zhuoran","family":"Wei","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Yongcun","family":"Liu","sequence":"additional","affiliation":[{"name":"Huawei Technologies Co."}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Xiang","family":"Yu","sequence":"additional","affiliation":[{"name":"Huawei Technologies Co."}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Yang","family":"Ren","sequence":"additional","affiliation":[{"name":"Huawei Technologies Co."}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Guoliang","family":"Li","sequence":"additional","affiliation":[{"name":"Department of Computer Science, Tsinghua University"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Haibo","family":"Chen","sequence":"additional","affiliation":[{"name":"Institute of Parallel and Distributed Systems, Shanghai Jiao Tong University"}],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"320","published-online":{"date-parts":[[2025,9,16]]},"reference":[{"key":"e_1_2_1_1_1","unstructured":"2025. GRewriter: Practical Query Rewriting with Automatic Rule Set Expansion in GaussDB (Appendix). https:\/\/ipads.se.sjtu.edu.cn:1313\/seafhttp\/f\/69dc90c86248426d9376\/?op=view."},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.14778\/3611540.3611544"},{"key":"e_1_2_1_3_1","doi-asserted-by":"publisher","DOI":"10.1145\/2723372.2742797"},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.14778\/3611479.3611497"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1145\/3183713.3190662"},{"key":"e_1_2_1_6_1","unstructured":"Nico Bruno and Cesar Galindo-Legaria. 2021. The Cascades Framework for Query Optimization at Microsoft. https:\/\/youtu.be\/pQe1LQJiXN0."},{"key":"e_1_2_1_7_1","doi-asserted-by":"publisher","DOI":"10.1145\/3035918.3058728"},{"key":"e_1_2_1_8_1","doi-asserted-by":"publisher","DOI":"10.14778\/3236187.3236200"},{"key":"e_1_2_1_9_1","volume-title":"Proceedings of the 8th Biennial Conference on Innovative Data Systems Research","author":"Chu Shumo","year":"2017","unstructured":"Shumo Chu, Chenglong Wang, Konstantin Weitz, and Alvin Cheung. 2017. Cosette: An Automated Prover for SQL.. In Proceedings of the 8th Biennial Conference on Innovative Data Systems Research (Chaminade, California, USA) (CIDR '17)."},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.1145\/3626768"},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.14778\/3611479.3611515"},{"key":"e_1_2_1_12_1","volume-title":"Market Share: All Software Markets","year":"2023","unstructured":"Gartner. 2023. Market Share: All Software Markets, Worldwide, 2022."},{"key":"e_1_2_1_13_1","first-page":"19","article-title":"The cascades framework for query optimization","volume":"18","author":"Graefe Goetz","year":"1995","unstructured":"Goetz Graefe. 1995. The cascades framework for query optimization. IEEE Data Eng. Bull. 18, 3 (1995), 19\u201329.","journal-title":"IEEE Data Eng. Bull."},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1145\/38713.38734"},{"key":"e_1_2_1_15_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICDE.1993.344061"},{"key":"e_1_2_1_16_1","unstructured":"The PostgreSQL Global Development Group. 2024. PostgreSQL. https:\/\/www.postgresql.org."},{"key":"e_1_2_1_17_1","unstructured":"IDC. 2024. 2024 First-Half China Relational Database Software Market Tracking Report (in Chinese)."},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.14778\/3685800.3685806"},{"key":"e_1_2_1_19_1","volume-title":"LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiency. arXiv preprint arXiv:2404.12872","author":"Li Zhaodonghui","year":"2024","unstructured":"Zhaodonghui Li, Haitao Yuan, Huiming Wang, Gao Cong, and Lidong Bing. 2024. LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiency. arXiv preprint arXiv:2404.12872 (2024)."},{"key":"e_1_2_1_20_1","unstructured":"Jie Liu and Barzan Mozafari. 2024. Query Rewriting via Large Language Models. arXiv:2403.09060 [cs.DB] https:\/\/arxiv.org\/abs\/2403.09060"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1145\/3448016.3452838"},{"key":"e_1_2_1_22_1","unstructured":"Microsoft. 2024. SQL Server. https:\/\/www.microsoft.com\/sql-server."},{"key":"e_1_2_1_23_1","unstructured":"Oracle. 2024. MySQL. https:\/\/www.mysql.com."},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/141484.130294"},{"key":"e_1_2_1_25_1","doi-asserted-by":"publisher","DOI":"10.1145\/582095.582099"},{"key":"e_1_2_1_26_1","volume-title":"Proceedings of the 2014 ACM SIGMOD international conference on Management of data. 337\u2013348","author":"Soliman Mohamed A","year":"2014","unstructured":"Mohamed A Soliman, Lyublena Antova, Venkatesh Raghavan, Amr El-Helw, Zhongxian Gu, Entong Shen, George C Caragea, Carlos Garcia-Alvarado, Foyzur Rahman, Michalis Petropoulos, et al. 2014. Orca: a modular query optimizer architecture for big data. In Proceedings of the 2014 ACM SIGMOD international conference on Management of data. 337\u2013348."},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1145\/3318464.3386134"},{"key":"e_1_2_1_28_1","unstructured":"Jeffrey Tao Natalie Maus Haydn Jones Yimeng Zeng Jacob R. Gardner and Ryan Marcus. 2025. Learned Offline Query Planning via Bayesian Optimization. arXiv:2502.05256 [cs.DB] https:\/\/arxiv.org\/abs\/2502.05256"},{"key":"e_1_2_1_29_1","unstructured":"TPC. 2024. TPC-DS. https:\/\/www.tpc.org\/tpcds\/."},{"key":"e_1_2_1_30_1","unstructured":"TPC. 2024. TPC-H. https:\/\/www.tpc.org\/tpch\/."},{"key":"e_1_2_1_31_1","doi-asserted-by":"publisher","DOI":"10.14778\/3681954.3682024"},{"key":"e_1_2_1_32_1","doi-asserted-by":"publisher","DOI":"10.1145\/3514221.3526125"},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICDE53745.2022.00250"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.14778\/3485450.3485456"}],"container-title":["Proceedings of the VLDB Endowment"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.14778\/3750601.3750622","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,9,16]],"date-time":"2025-09-16T13:41:40Z","timestamp":1758030100000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.14778\/3750601.3750622"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,8]]},"references-count":34,"journal-issue":{"issue":"12","published-print":{"date-parts":[[2025,8]]}},"alternative-id":["10.14778\/3750601.3750622"],"URL":"https:\/\/doi.org\/10.14778\/3750601.3750622","relation":{},"ISSN":["2150-8097"],"issn-type":[{"value":"2150-8097","type":"print"}],"subject":[],"published":{"date-parts":[[2025,8]]},"assertion":[{"value":"2025-09-16","order":3,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}