R-Bot: An LLM-based Query Rewrite System
Not on the map. Why?
Abstract (arXiv)
Query rewrite is essential for optimizing SQL queries to improve their execution efficiency without changing their results. Traditionally, this task has been tackled through heuristic and learning-based methods, each with its limitations in terms of inferior quality and low robustness. Recent advancements in LLMs offer a new paradigm by leveraging their superior natural language and code comprehension abilities. Despite their potential, directly applying LLMs like GPT-4 has faced challenges due to problems such as hallucinations, where the model might generate inaccurate or irrelevant results. To address this, we propose R-Bot, an LLM-based query rewrite system with a systematic approach. We first design a multi-source rewrite evidence preparation pipeline to generate query rewrite evidences for guiding LLMs to avoid hallucinations. We then propose a hybrid structure-semantics retrieval method that combines structural and semantic analysis to retrieve the most relevant rewrite evidences for effectively answering an online query. We next propose a step-by-step LLM rewrite method that iteratively leverages the retrieved evidences to select and arrange rewrite rules with self-reflection. We conduct comprehensive experiments on real-world datasets and widely used benchmarks, and demonstrate the superior performance of our system, R-Bot, surpassing state-of-the-art query rewrite methods. The R-Bot system has been deployed at Huawei and with real customers, and the results show that the proposed R-Bot system achieves lower query latency.
Key facts. Cited by 16 papers in the map (data through 14 Oct 2026). Builds on 19 of its 60 references that are in the map. First posted on arXiv 2 Dec 2024.
Builds on
19 of 60 references.
References · 19
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
- 2018UMAP: Uniform Manifold Approximation and Projection for Dimension Reductioncited by 2,898
- 2023Retrieval-Augmented Generation for Large Language Models: A Surveycited by 2,212
- 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelinescited by 832
- 2024MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategiescited by 723
- 2022A Survey on In-context Learningcited by 721
- 2024RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrievalcited by 532
- 2023A Survey of Hallucination in Large Foundation Modelscited by 368
7 more
- 2024The Dawn of Natural Language to SQL: Are We Fully Ready?cited by 79
- 2023GPTuner: A Manual-Reading Database Tuning System via GPT-Guided Bayesian Optimizationcited by 29
- 2023D-Bot: Database Diagnosis System using Large Language Modelscited by 28
- 2018Apache Calcite: A Foundational Framework for Optimized Query Processing Over Heterogeneous Data Sourcescited by 25
- 2024LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiencycited by 16
- 2024Revolutionizing Database Q&A with Large Language Models: Comprehensive Benchmark and Evaluationcited by 7
- 2023QueryBooster: Improving SQL Performance Using Middleware Services for Human-Centered Query Rewritingcited by 5
Built on by
Citing papers per year: 2025: 9; 2026: 7.
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
- 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
- 2026Arming Data Agents with Tribal Knowledgecited by 7
- 2026AgenticDataBench: A Comprehensive Benchmark for Data Agentscited by 7
- 2026Agentic Transaction: Towards ACID-Compliant Agent Systemscited by 3
- 2025Ask2Loc: Learning to Locate Instructional Visual Answers by Asking Questionscited by 2
- 2025LLM Unlearning on Noisy Forget Sets: A Study of Incomplete, Rewritten, and Watermarked Datacited by 2
- 2026AI-Driven Research for Databasescited by 2
4 more
- 2025QUPID: Quantified Understanding for Enhanced Performance, Insights, and Decisions in Korean Search Enginescited by 1
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiencycited by 1
- 2026QUARK: Robust Retrieval under Non-Faithful Queries via Query-Anchored Aggregationcited by 0
- 2026Data Agents: Agentic Data Systemscited by 0
- 2026Data Agents: Agentic Data Systems21 Sep 2026
- 2026Agentic Transaction: Towards ACID-Compliant Agent Systems14 Aug 2026
- 2026AgenticDataBench: A Comprehensive Benchmark for Data Agents2 Jul 2026
- 2026AI-Driven Research for Databases8 Apr 2026
- 2026Memory in the LLM Era: Modular Architectures and Strategies in a Unified Framework2 Apr 2026
- 2026Arming Data Agents with Tribal Knowledge13 Feb 2026
- 2026QUARK: Robust Retrieval under Non-Faithful Queries via Query-Anchored Aggregation28 Jan 2026
- 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
- 2025LLM Unlearning on Noisy Forget Sets: A Study of Incomplete, Rewritten, and Watermarked Data10 Oct 2025
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiency12 Aug 2025
- 2025QUITE: A Query Rewrite System Beyond Rules with LLM Agents9 Jun 2025
4 more
- 2025QUPID: Quantified Understanding for Enhanced Performance, Insights, and Decisions in Korean Search Engines12 May 2025
- 2025Ask2Loc: Learning to Locate Instructional Visual Answers by Asking Questions22 Apr 2025
- 2025In-depth Analysis of Graph-based RAG in a Unified Framework6 Mar 2025
- 2025ArchRAG: Attributed Community-based Hierarchical Retrieval-Augmented Generation14 Feb 2025
- 2025A Survey of Data Agents: Emerging Paradigm or Overstated Hype?cited by 30
- 2025QUITE: A Query Rewrite System Beyond Rules with LLM Agentscited by 8
- 2026Arming Data Agents with Tribal Knowledgecited by 7
- 2026AgenticDataBench: A Comprehensive Benchmark for Data Agentscited by 7
- 2026Agentic Transaction: Towards ACID-Compliant Agent Systemscited by 3
- 2026Data Agents: Agentic Data Systemscited by 0
- 2026Data Agents: Agentic Data Systems21 Sep 2026
- 2026Agentic Transaction: Towards ACID-Compliant Agent Systems14 Aug 2026
- 2026AgenticDataBench: A Comprehensive Benchmark for Data Agents2 Jul 2026
- 2026Arming Data Agents with Tribal Knowledge13 Feb 2026
- 2025A Survey of Data Agents: Emerging Paradigm or Overstated Hype?27 Oct 2025
- 2025QUITE: A Query Rewrite System Beyond Rules with LLM Agents9 Jun 2025
- 2026Memory in the LLM Era: Modular Architectures and Strategies in a Unified Frameworkcited by 12
- 2025Ask2Loc: Learning to Locate Instructional Visual Answers by Asking Questionscited by 2
- 2026AI-Driven Research for Databasescited by 2
- 2025QUPID: Quantified Understanding for Enhanced Performance, Insights, and Decisions in Korean Search Enginescited by 1
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiencycited by 1
- 2026QUARK: Robust Retrieval under Non-Faithful Queries via Query-Anchored Aggregationcited by 0
- 2026AI-Driven Research for Databases8 Apr 2026
- 2026Memory in the LLM Era: Modular Architectures and Strategies in a Unified Framework2 Apr 2026
- 2026QUARK: Robust Retrieval under Non-Faithful Queries via Query-Anchored Aggregation28 Jan 2026
- 2025E3-Rewrite: Learning to Rewrite SQL for Executability, Equivalence,and Efficiency12 Aug 2025
- 2025QUPID: Quantified Understanding for Enhanced Performance, Insights, and Decisions in Korean Search Engines12 May 2025
- 2025Ask2Loc: Learning to Locate Instructional Visual Answers by Asking Questions22 Apr 2025