LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiency
Not on the map. Why?
Abstract (arXiv)
Query rewrite, which aims to generate more efficient queries by altering a SQL query's structure without changing the query result, has been an important research problem. In order to maintain equivalence between the rewritten query and the original one during rewriting, traditional query rewrite methods always rewrite the queries following certain rewrite rules. However, some problems still remain. Firstly, existing methods of finding the optimal choice or sequence of rewrite rules are still limited and the process always costs a lot of resources. Methods involving discovering new rewrite rules typically require complicated proofs of structural logic or extensive user interactions. Secondly, current query rewrite methods usually rely highly on DBMS cost estimators which are often not accurate. In this paper, we address these problems by proposing a novel method of query rewrite named LLM-R2, adopting a large language model (LLM) to propose possible rewrite rules for a database rewrite system. To further improve the inference ability of LLM in recommending rewrite rules, we train a contrastive model by curriculum to learn query representations and select effective query demonstrations for the LLM. Experimental results have shown that our method can significantly improve the query execution efficiency and outperform the baseline methods. In addition, our method enjoys high robustness across different datasets.
Key facts. Cited by 16 papers in the map (data through 14 Oct 2026). Builds on 14 of its 42 references that are in the map. First posted on arXiv 19 Apr 2024.
Builds on
14 of 42 references.
References · 14
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,182
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
- 2017SemEval-2017 Task 1: Semantic Textual Similarity - Multilingual and Cross-lingual Focused Evaluationcited by 1,001
- 2023Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design or: How I learned to start worrying about prompt formattingcited by 817
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 688
- 2023Larger language models do in-context learning differentlycited by 394
- 2023Unified Demonstration Retriever for In-Context Learningcited by 142
- 2018Apache Calcite: A Foundational Framework for Optimized Query Processing Over Heterogeneous Data Sourcescited by 25
- 2021Efficient Contrastive Learning via Novel Data Augmentation and Curriculum Learningcited by 14
- 2022Pseudo-Labeled Auto-Curriculum Learning for Semi-Supervised Keypoint Localizationcited by 14
Built on by
Citing papers per year: 2024: 1; 2025: 11; 2026: 4.
16 papers.
Sort:
By area:
- 2025In-depth Analysis of Graph-based RAG in a Unified Frameworkcited by 46
- 2025A Survey of Data Agents: Emerging Paradigm or Overstated Hype?cited by 30
- 2025ArchRAG: Attributed Community-based Hierarchical Retrieval-Augmented Generationcited by 28
- 2024R-Bot: An LLM-based Query Rewrite Systemcited by 16
- 2025BookRAG: A Hierarchical Structure-aware Index-based Approach for Retrieval-Augmented Generation on Complex Documentscited by 16
- 2026Memory in the LLM Era: Modular Architectures and Strategies in a Unified Frameworkcited by 12
- 2025QUITE: A Query Rewrite System Beyond Rules with LLM Agentscited by 8
- 2025ReVision: A Dataset and Baseline VLM for Privacy-Preserving Task-Oriented Visual Instruction Rewritingcited by 6
- 2025CoQuIR: A Comprehensive Benchmark for Code Quality-Aware Information Retrievalcited by 6
- 2025SQLBarber: A System Leveraging Large Language Models to Generate Customized and Realistic SQL Workloadscited by 4
- 2025Cost Trade-offs of Reasoning and Non-Reasoning Large Language Models in Text-to-SQLcited by 2
- 2026AI-Driven Research for Databasescited by 2
4 more
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiencycited by 1
- 2025Training-Free Query Optimization via LLM-Based Plan Similaritycited by 0
- 2026Accurate Table Question Answering with Accessible LLMscited by 0
- 2026When to Vote, When to Rewrite: Disagreement-Guided Strategy Routing for Test-Time Scalingcited by 0
- 2026When to Vote, When to Rewrite: Disagreement-Guided Strategy Routing for Test-Time Scaling29 Apr 2026
- 2026AI-Driven Research for Databases8 Apr 2026
- 2026Memory in the LLM Era: Modular Architectures and Strategies in a Unified Framework2 Apr 2026
- 2026Accurate Table Question Answering with Accessible LLMs6 Jan 2026
- 2025Cost Trade-offs of Reasoning and Non-Reasoning Large Language Models in Text-to-SQL26 Dec 2025
- 2025BookRAG: A Hierarchical Structure-aware Index-based Approach for Retrieval-Augmented Generation on Complex Documents3 Dec 2025
- 2025A Survey of Data Agents: Emerging Paradigm or Overstated Hype?27 Oct 2025
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiency12 Aug 2025
- 2025SQLBarber: A System Leveraging Large Language Models to Generate Customized and Realistic SQL Workloads8 Jul 2025
- 2025QUITE: A Query Rewrite System Beyond Rules with LLM Agents9 Jun 2025
- 2025Training-Free Query Optimization via LLM-Based Plan Similarity6 Jun 2025
- 2025CoQuIR: A Comprehensive Benchmark for Code Quality-Aware Information Retrieval31 May 2025
4 more
- 2025In-depth Analysis of Graph-based RAG in a Unified Framework6 Mar 2025
- 2025ReVision: A Dataset and Baseline VLM for Privacy-Preserving Task-Oriented Visual Instruction Rewriting20 Feb 2025
- 2025ArchRAG: Attributed Community-based Hierarchical Retrieval-Augmented Generation14 Feb 2025
- 2024R-Bot: An LLM-based Query Rewrite System2 Dec 2024
- 2024R-Bot: An LLM-based Query Rewrite Systemcited by 16
- 2026Memory in the LLM Era: Modular Architectures and Strategies in a Unified Frameworkcited by 12
- 2025ReVision: A Dataset and Baseline VLM for Privacy-Preserving Task-Oriented Visual Instruction Rewritingcited by 6
- 2025CoQuIR: A Comprehensive Benchmark for Code Quality-Aware Information Retrievalcited by 6
- 2025SQLBarber: A System Leveraging Large Language Models to Generate Customized and Realistic SQL Workloadscited by 4
- 2026AI-Driven Research for Databasescited by 2
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiencycited by 1
- 2025Training-Free Query Optimization via LLM-Based Plan Similaritycited by 0
- 2026Accurate Table Question Answering with Accessible LLMscited by 0
- 2026AI-Driven Research for Databases8 Apr 2026
- 2026Memory in the LLM Era: Modular Architectures and Strategies in a Unified Framework2 Apr 2026
- 2026Accurate Table Question Answering with Accessible LLMs6 Jan 2026
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiency12 Aug 2025
- 2025SQLBarber: A System Leveraging Large Language Models to Generate Customized and Realistic SQL Workloads8 Jul 2025
- 2025Training-Free Query Optimization via LLM-Based Plan Similarity6 Jun 2025
- 2025CoQuIR: A Comprehensive Benchmark for Code Quality-Aware Information Retrieval31 May 2025
- 2025ReVision: A Dataset and Baseline VLM for Privacy-Preserving Task-Oriented Visual Instruction Rewriting20 Feb 2025
- 2024R-Bot: An LLM-based Query Rewrite System2 Dec 2024