arXiv:2610.07622cs.IROct 2026

Manuscript Offprint

arXiv:2610.07622

DBRAG: Multi-Table Retrieval-Augmented Generation for Complex Database Queries

Prince Larbi Ampofo, Ryoji Kubo, Djellel Difallah

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Recent advancements in large language models have introduced new capabilities for reasoning over structured data, particularly through program-aided tools that can analyze tables. However, many existing methods address single-table scenarios or assume that the relevant tables are already provided. In practice, users often issue complex data exploration queries over entire databases, where relevant information may be distributed across multiple relations. In this work, we introduce DBRAG, a retrieval-augmented generation framework tailored for multi-table question answering. DBRAG first retrieves candidate tables using an offline table index, enriches their summaries with query-relevant rows, and uses an LLM to rerank the candidates. A program-aided reasoner then selects the required tables and executes operations over their full contents, keeping the initial prompt context compact. Experiments on the Spider, GeoQuery, and ATIS datasets used in this study demonstrate improvements in table retrieval and multi-table question answering.

1 Introduction

Tabular data structures are a widely used data model for storing information in various domains. In real-world applications, these tables often contain complex, interrelated data with relational dependencies. When interpreted, relational data can lead to improved decision-making, enhanced operational efficiency, and the discovery of new hidden insights (Fey et al., 2024). Given the inherent complexity of structured query languages, such as SQL, using natural language can lower the barrier for data exploration (Li et al., 2024). Consequently, table question-answering (QA) has emerged as an important research area focused on developing systems that can understand natural language queries and extract relevant insights from tabular data (Jin et al., 2022; Lu et al., 2025).

Although significant progress has been made in single-table QA scenarios (Liu et al., 2022; Herzig et al., 2020; Nan et al., 2022; Zhu et al., 2021), the more challenging and practical task of multi-table QA remains relatively underexplored. Multi-table QA involves answering questions that require the integration of information from multiple tables, necessitating sophisticated reasoning and advanced data fusion techniques (Pal et al., 2023). This challenge is further compounded by the complex relationships between tables, such as identifying joinable keys or overlapping attributes, particularly when such relationships lack a well-structured explicit relational schema, as is often the case in web tables and data lakes (Cafarella et al., 2008; Chapman et al., 2020).

Many existing studies assume that the relevant tables are already provided (Chen et al., 2024b; Pal et al., 2023; Wang et al., 2024). In an open-domain table QA setting, the system must instead retrieve them from a larger corpus. This requires considering both query-table relevance and table-table relationships: a table with limited direct relevance may still be needed to connect complementary information (Chen et al., 2024a).

Large language models (LLMs) have demonstrated remarkable proficiency in various natural language processing tasks (Minaee et al., 2024). Their adaptation to QA via retrieval-augmented generation (RAG) has led to substantial performance gains (Lewis et al., 2020). In the RAG framework, relevant information is first efficiently retrieved from a pre-indexed large corpus and used to augment the query provided to the LLM, thereby mitigating issues such as hallucinations and outdated knowledge.

Despite the effectiveness of the RAG framework in single-table QA contexts (Chen et al., 2024b), its application to multi-table QA remains underexplored. The challenges of multi-table QA stem from several factors. First, multi-table QA requires the system to reason across multiple tables, often necessitating different types of joins and aggregations. Second, the sheer volume of tables in a typical database complicates the retrieval process, as the system must identify not only the main tables relevant to a query but also any auxiliary tables needed to connect and augment the data. Third, each table can vary significantly in size, both in the number of columns and rows. For instance, data warehouses often contain wide tables with billions of rows. These challenges, combined with the limitations of current LLM context windows, make the direct application of LLMs to multi-table QA non-trivial, thereby necessitating novel approaches.

To tackle the aforementioned challenges, we propose a novel methodology that extends the RAG framework to encompass the entire database. Our approach decomposes the problem of multi-table QA into two critical subtasks, multi-table retrieval and multi-table reasoning. ① In the retrieval step, we adopt a two-pronged approach to identify the relevant tables in a scalable manner. First, table search quickly selects a subset of tables relevant to the query from the entire database using a table index. Next, we enrich the tables of interest by augmenting them with query-relevant rows. The collected context is then fed into an LLM to select the most promising tables. ② In multi-table reasoning, we propose a novel reasoning protocol designed to answer the natural language question given the retrieved tables. Specifically, we design a multi-table-aware Chain-of-Thought prompting technique combined with a program-aided reasoner that executes operations over the retrieved tables and returns the final answer. Our experiments on multi-table QA datasets demonstrate that DBRAG not only improves the retrieval of relevant tables but also enhances the reasoning task, resulting in higher overall QA performance in the evaluated settings.

In summary, we make the following contributions:

★ We introduce a RAG approach for multi-table question answering in settings where the relevant tables must be retrieved from a large table corpus.

★ We propose DBRAG, a novel framework that decomposes multi-table QA into two subtasks: a two-stage retrieval strategy that leverages table indexing and context enrichment, and a multitable reasoning protocol that integrates Chain-of-Thought prompting with program-aided execution.

★ We demonstrate through comprehensive experiments that DBRAG improves both table retrieval and reasoning performance, resulting in effective end-to-end QA execution.

Reproducibility Code, datasets, prompts, relevant parameters, and details of the experimental setup are available in the project repository: https://github.com/colab-nyuad/DBRAG