Manuscript Offprint
arXiv:2611.07339DiagDBench: Evaluating Agentic LLMs on Interactive Database Diagnosis and Anomaly Remediation
Xinxin Zhao , Rong Kang , Tieying Zhang , Cuiping Li , Hong Chen , Jing Zhang
School of Information, Renmin University of China, Beijing, China, Beijing Key Laboratory of Intelligent Database Systems and Applications, Beijing, China, Engineering Research Center of Database and Business Intelligence, MOE, China, Key Laboratory of Data Engineering and Knowledge Engineering, MOE, China, ByteDance Inc., China {zhaoxinxin798,licuiping,chong,zhang-jing}@ruc.edu.cn {kangrong.cn,tieying.zhang}@bytedance.com
ABSTRACT
Database diagnosis and anomaly remediation are essential to reliable database management system (DBMS) operation. Despite advances in large language model (LLM)-based database agents, constructing live DBMS environments that reproduce diverse anomalies at scale remains challenging, limiting the availability of executable samples for database agent training and evaluation. To this end, we introduce DIAGDBENCH, a large-scale benchmark for training and evaluating database agents on interactive diagnosis, anomaly remediation, and optional workload performance optimization across diverse, realistic anomaly scenarios. Each sample pairs a user request, comprising an issue description and an anomaly-verified workload under which the issue was observed, with a self-contained, executable DBMS environment that supports real-time monitoring, interactive diagnosis, remediation, and workload execution. To construct these samples at scale, we propose an LLM-based framework with two complementary pipelines: Manual-Guided Anomaly Synthesis, which sequentially synthesizes user requests, database modifications, and anomaly-injection scripts grounded in DBA manuals and official DBMS documentation; and Incident-Guided Anomaly Reproduction, which reconstructs anomaly samples end to end from real-world enterprise online diagnosis incidents. Built using this framework with sample filtering, expert review, and refinement, DIAGDBENCH comprises 6,940 synthesized training samples and a held-out test set of 454 expert-annotated samples, spanning three hardware configurations, two DBMSs, and three database schemas. Extensive evaluations of database agents powered by multiple LLMs demonstrate that even the best-performing agent, ReAct with GPT-6 Astra, scores only 56.24, whereas most agents score below 45, underscoring the difficulty of DIAGDBENCH.
KEYWORDS
Database Diagnosis, Large Language Model, Benchmark
doi:XX.XX/XXX.XX
This work is licensed under the Creative Commons BY-NC-ND 4.0 International License. Visit https://creativecommons.org/licenses/by-nc-nd/4.0/ to view a copy of
PVLDB Artifact Availability:
The source code, data, and/or other artifacts have been made available at https://github.com/RUCKBReasoning/DiagDBench.
1 INTRODUCTION
Database diagnosis aims to identify the root causes of anomalous behavior in database management systems (DBMSs) through systematic analysis of monitoring metrics, logs, and query executions, thereby guiding targeted remediation of the underlying issues.
Prior Work and Remaining Limitations. Traditional rule-based or machine-learning-based approaches [12, 19, 38] have focused on detecting anomalies in time-series metrics and identifying their root-cause categories. DBPA [9] supports the evaluation of such approaches by providing pre-collected metric data paired with anomaly labels, alongside fixed procedures for reproducing nine anomaly types. With the emergence of large language models (LLMs), LLM-based systems [31, 43–45] have extended diagnostic capabilities beyond root-cause categorization, enabling LLMs to emulate database administrators (DBAs) by interacting with DBMSs and generating comprehensive natural-language diagnostic reports that combine causal-chain analysis with remediation recommendations.
However, unlike conventional classification tasks that support training and evaluation on static datasets, evaluating interactive database agents requires live DBMS environments that reproduce the target anomalies. Moreover, time-series metric records collected through routine monitoring can be readily assembled into static training datasets, whereas constructing complete, executable anomalous DBMS environments at scale for interactive database agent training remains challenging. D-Bot [45] releases 539 anomaly cases for PostgreSQL with detailed scenario descriptions, alongside 2,819 static training records. More recently, DBA-Bench [2] comprises 241 cases across PostgreSQL and TiDB for supporting interactive database agent evaluation. Nevertheless, it contain only a few hundred evaluation cases without separate training data.
Our Proposal. To bridge this gap, we introduce DIAGDBENCH, a large-scale benchmark for evaluating interactive database agents on anomaly diagnosis, remediation, and workload performance
Jing Zhang is the corresponding author.
this license. For any use beyond those covered by this license, obtain permission by emailing info@vldb.org. Copyright is held by the owner/author(s). Publication rights licensed to the VLDB Endowment.
Proceedings of the VLDB Endowment, Vol. 20, No. 1 ISSN 2150-8097. doi:XX.XX/XXX.XX optimization. Specifically, DIAGDBENCH distinguishes itself from existing benchmarks through three core strengths: (1) Scenario Diversity, encompassing diverse anomaly-injection mechanisms and operational settings beyond fixed templates; (2) Large-Scale Dataset, comprising thousands of executable anomaly samples; and (3) Real-World Grounding, with anomaly samples derived from source material collected in real-world database scenarios.
Challenges and Solutions. Constructing a large-scale benchmark that enables database agents to perform interactive diagnosis and remediation within live DBMS environments while capturing diverse, realistic anomaly scenarios presents the following key challenges:
(1) How can DIAGDBENCH ensure the diversity and realism of its anomaly samples? Addressing the limited availability of executable samples for training and evaluating interactive database agents requires expanding both dataset scale and the diversity of anomaly definitions. To meet this demand, we collect source material for anomaly samples through two channels: (i) we obtain DBMS operational manuals from experienced DBAs and summarize common anomaly definitions, enriched with error codes and timeout information retrieved from official DBMS documentation, to establish a public source; and (ii) we collect real-world enterprise records of online diagnosis incidents as a private source.
(2) How can different anomaly sources be transformed into complete, independently executable database anomaly samples at scale? Constructing complete, executable database anomaly samples from above anomaly definitions and incident records at scale is non-trivial, as this requires maintaining sample quality and diversity while ensuring that the specific scenarios reflect real-world database operations. To address this challenge, we propose an LLM-based database anomaly sample construction framework with two complementary pipelines tailored to the respective sources: (i) Manual-Guided Anomaly Synthesis, which draws on official DBMS documentation and DBA manuals to sequentially synthesize user requests, database modification operations, and anomaly-injection scripts, respectively; and (ii) Incident-Guided Anomaly Reproduction, which reconstructs complete database anomaly samples end to end from real-world enterprise online diagnosis incident records.
(3) How can we reliably evaluate database diagnosis agents based on the simulative anomaly samples? LLM-based synthesis may introduce hallucinations that lead to validity issues such as (i) inconsistencies between user requests and anomaly-injection scripts (e.g., reporting table corruption or duplicate-key errors when the injection script only drops secondary indexes and holds locks, without reproducing either reported issue), and (ii) failures to reproduce the intended anomalous state (e.g., expecting row-level locks to block SELECT queries on a table while observing that all such queries complete successfully). These validity issues compromise evaluation reliability, making it difficult to determine whether an agent's failure stems from defects in the anomaly sample or limitations of the agent itself. To this end, we filter the constructed samples for anomaly-injection validity, and select challenging candidates based on reference database agent's diagnostic and remediation performance. Following iterative expert review and refinement, 454 expert-annotated samples are retained as a separate held-out test set for evaluating database diagnosis agents. Furthermore, strong diagnostic reasoning does not necessarily translate into effective remediation that directly modifies the anomalous environment. We therefore evaluate database diagnosis agents using two complementary scoring components that assess both anomaly remediation outcomes and diagnostic report quality: (i) Execution-Grounded Remediation Evaluation scores remediation outcomes through comparing workload performance between the normal baseline and post-remediation states, along with an LLM-as-a-judge assessment of whether any agent-optimized workload preserves the identical semantics of the original anomaly-verified workload; and (ii) LLM-Judged Diagnostic Report Evaluation uses the original anomaly sample as the ground-truth reference for LLM-based scoring across four dimensions: root-cause accuracy, evidence-grounded reasoning, remediation appropriateness, and operational safety.
DIAGDBENCH. Building on these solutions, we construct DIAGDBENCH, comprising 6,940 synthesized training samples and a separate held-out test set of 454 expert-annotated samples, which spans three hardware configurations, two DBMSs, and three database schemas. Unlike conventional benchmarks for text-to-SQL [14, 16] and question answering [29], database diagnosis and anomaly remediation require agents to inspect and modify the state of an anomalous database. We therefore package each anomaly sample as a self-contained sandbox providing an independent live DBMS environment that supports system monitoring, interactive diagnosis, anomaly remediation, and workload execution. Each sample in DIAGDBENCH pairs this sandbox with a user request comprising an issue description and an anomaly-verified workload for evaluation.
Contributions. Our main contributions are as follows:
-
Benchmark for Interactive Database Agent Evaluation. We introduce DIAGDBENCH, a benchmark spanning three hardware configurations, two DBMSs, and three database schemas, with 6,940 synthesized training samples and a held-out test set of 454 expert-annotated samples. Each anomaly sample pairs a user request—comprising an issue description and the workload under which the issue was observed—with an independent live DBMS environment that supports performance monitoring, interactive diagnosis, anomaly remediation, and workload execution.
-
Database Anomaly Sample Construction Framework. We propose an LLM-based framework with two complementary pipelines to construct diverse anomaly samples at scale: Manual-Guided Anomaly Synthesis follows a three-stage process grounded in official DBMS documentation and DBA manuals, while Incident-Guided Anomaly Reproduction reconstructs samples end to end from real-world enterprise online diagnosis incident records.
-
Comprehensive Experimental Evaluation. We conduct extensive evaluations of multiple database agents to assess their diagnostic and remediation capabilities. Even the best-performing agent, built on the ReAct framework and powered by GPT-6 Astra, achieves only 56.24, while most other agents score below 45, underscoring the challenges posed by DIAGDBENCH.
2 PRELIMINARY
2.1 Problem Definition
DBAs typically address incoming online diagnosis requests through examining relevant performance metrics, identifying potential root causes, and performing timely remediation, ultimately summarizing

Figure 1: Overview of the LLM-based database anomaly sample construction framework.
this process in a diagnostic report with feasible remediation actions. Hence, we formally define the database diagnosis task as follows:
Definition 1 (Database Diagnosis). Upon receiving an online diagnosis request, the DBA diagnoses and remediates the issue based on the live anomalous DBMS environment , user-issue description , and anomaly-verified workload under which the issue was observed, ultimately restoring—and potentially improving—the workload's expected execution performance and yielding a diagnostic report with remediation actions -
Here, denotes a human DBA or an LLM agent acting in that role. Successful remediation restores the DBMS environment to a normal or optimized state , with a potentially optimized workload . To this end, we identify the fundamental components of an anomaly sample for database diagnosis as follows:
Definition 2 (Database Anomaly Sample). Each sample comprises a user request and the corresponding DBMS environment .
Here, the user request comprises a user-issue description and an anomaly-verified workload , while the DBMS environment includes the hardware configuration , database instance , and anomaly-triggering mechanism .
2.2 ReAct Framework
ReAct [37], which underpins our LLM-based database anomaly sample construction framework detailed in subsequent sections, interleaves natural-language reasoning with task-specific actions
through a Thought–Action–Observation loop. Starting from task-specific instructions, the LLM reasons about the next step (Thought), invokes an external tool or interacts with the environment (Action), and receives the resulting feedback (Observation). The accumulated reasoning traces, actions, and observations provide context for subsequent decisions, enabling the LLM to assess intermediate outcomes, revise its plan, and adjust its actions until it submits its final output or a predefined termination condition is met. By coupling reasoning with execution feedback, ReAct supports adaptive task execution grounded in observations from external environments.
3 OVERVIEW
Database diagnosis and anomaly remediation require direct interaction with live DBMS environments to restore normal operation. We therefore encapsulate each sample in an isolated Docker [6] container that enables users to instantiate sample environment on compatible hosts without relying on a fixed evaluation server.
Building on the preceding definitions and containerized environments, we propose an LLM-based framework to construct database anomaly samples for DIAGDBENCH at scale, as illustrated in Figure 1. Tailored to different anomaly sources, this framework offers two complementary pipelines to support diverse sample construction while allowing users to select suitable approach for their construction requirements. Given specified hardware configurations and database instances, these pipelines generate user requests and database operations required to instantiate anomalous environments:
- Manual-Guided Anomaly Synthesis (Section 4) instantiated abstract anomaly definitions derived from DBA manuals and official DBMS documentation as executable samples through three sequential stages: (i) inferring user-observable symptoms from
Table 1: 17 single-anomaly root-cause definitions summarized from DBA operational manuals.
| Anomaly Layer | Root-Cause Definition |
|---|---|
| SQL Layer | SQL Workload Logic AnomalySchema and Index Design AnomalyOptimizer Statistics AnomalyQuery Plan Selection Anomaly |
| DBMS Layer | Transaction Lock Contention AnomalyMulti-Version Concurrency Control (MVCC)Version Maintenance AnomalyDBMS Configuration AnomalyDatabase Memory Allocation AnomalyBuffer Cache and Latch Contention AnomalyTransaction Log Subsystem AnomalyReplication Synchronization AnomalyData Block and Index Integrity Anomaly |
| Server Layer | Storage I/O Throughput AnomalyStorage Space Capacity AnomalyCPU Resource AnomalyOperating System Resource Limit AnomalyNetwork and Connectivity Resource Anomaly |
each anomaly definition to synthesize a user request comprising a user-issue description and an anomaly-verified workload; (ii) generating optional database modifications to support valid anomaly-verified workload execution and establish anomaly-specific data distributions; and (iii) constructing an anomaly-injection script to trigger the intended anomalous behavior.
- Incident-Guided Anomaly Reproduction (Section 5) reconstructs executable samples end to end from real-world enterprise online diagnosis records detailing user requests, root-cause analyses, and diagnostic traces. Compared with abstract anomaly definitions, these records provide richer, more explicit guidance, thereby supporting a single-stage, multi-turn process that directly generates and refines interdependent sample components using recorded evidence to mitigate hallucination risk.
Each anomaly sample comprises (i) a user request containing a user-issue description and an anomaly-verified workload; (ii) an anomalous DBMS container specified by its environmental configuration, database modification operations, and an anomaly-injection script; and (iii) an anomaly definition, as detailed in Section 6.
4 MANUAL-GUIDED ANOMALY SYNTHESIS
We propose the Manual-Guided Anomaly Synthesis pipeline to construct diverse, challenging anomaly samples from abstract definitions derived from DBA manuals and official DBMS documentation. It comprises three sequential stages for synthesizing user requests, database modifications, and anomaly injections, respectively.
4.1 Anomaly Sample Source
Explicit root-cause definitions grounded in real-world operational experience are essential for instantiated concrete database anomaly samples. To this end, we collect DBMS operational manuals in which enterprise DBAs summarize their practical experience, and extract 17 single-anomaly root-cause definitions as presented in Table 1.
To account for anomalies with multiple root causes, we enumerate combinations of these definitions (e.g., Schema and Index Design Anomaly + Transaction Lock Contention Anomaly, where missing indexes can cause UPDATE statements to scan more rows and hold locks longer, causing blocking chains that delay other transactions and intensify lock contention), yielding 833 general root-cause definitions for synthesizing more diverse and challenging scenarios.
Since distinct diagnostic paths may converge on the same root cause, a given root-cause definition can correspond to diverse user-observable symptoms (e.g., error messages or execution timeouts). To enrich these definitions into more concrete anomaly samples, we build a knowledge base of user-observable symptoms through collecting error-code explanations and timeout reason analyses separately from the official documentation of PostgreSQL¹ and MySQL², as presented in Table 2. Each entry is structured into a symptom name, official description, associated root-cause analysis and category, and effective remediation recommendations.
After constructing the knowledge base, we retrieve relevant entries using formatted anomaly root-cause definitions as queries. Our hybrid lexical retrieval approach comprises two components:
-
Field-weighted BM25 [30] prioritizes key-field matches (e.g., symptom names and official descriptions) while accounting for term rarity, frequency, and entry length to mitigate bias toward long or repetitive entries.
-
Term overlap quantifies both query-term coverage and the proportion of entry terms shared with the query.
For each DBMS, we independently retrieve entries from its error-code and timeout knowledge bases. Let denote either knowledge base, the distinct terms extracted from the root-cause definition, and the distinct terms in the retrieval fields of entry (e.g., symptom name and official description). We aggregate term counts as , where is the field content, counts occurrences of term , and is a predefined field weight fixed during retrieval. With the weighted entry length and its average over , the field-weighted BM25 score is:
where , , and , with counting entries whose retrieval fields contain .
We normalize BM25 within as , where , assigning zero when .
The term-overlap score combines query-term coverage with the proportion of entry terms matching the query:
with a score of zero if either term set is empty.
We compute the final relevance score as a weighted combination of the normalized BM25 and term-overlap scores as follows:
¹https://www.postgresql.org/docs/16/.
²https://dev.mysql.com/doc/refman/8.4/en/.
Table 2: User-observable symptoms collected from the official website of each DBMS.
| DBMS | # Error Code Types | # Timeout Types | Examples |
|---|---|---|---|
| PostgreSQL | 249 | 13 | Error Code: 40 P01 (deadlock_detected), indicating a transaction rollback caused by a detected deadlock. Timeout: statement_timeout aborts statements exceeding the time limit (0 disables the timeout). |
| MySQL | 6068 | 17 | Error Code: 1213 (ER_LOCK_DEADLOCK) indicates a deadlock during lock acquisition; the transaction should be retried. Timeout: innodb_lock_wait_timeout sets the maximum row-lock wait time for an InnoDB transaction. |
For each root-cause definition, we retain the highest-scoring entries with nonzero relevance scores from each knowledge base K (top 25% for error codes and 40% for timeouts). To enhance the diversity of final anomaly definitions, we select up to two entries from each retained set, prioritizing less frequently retrieved entries and favoring higher relevance scores when retrieval counts are equal. Each retrieved symptom is paired with its corresponding root-cause definition, yielding 1,666 complete anomaly definitions per DBMS for subsequent anomaly sample construction. Notably, user-defined anomaly definitions can also serve as alternative inputs without modifying the subsequent three-stage synthesis procedure.
4.2 User Request Synthesis
Given an anomaly definition, we first synthesize a user request comprising a user-issue description and an anomaly-verified workload under which the anomaly is observed. In practice, users may encounter unexpected performance degradation or execution errors, thereby submitting online requests to DBAs for anomaly diagnosis and remediation. To simulate this process, we adopt the ReAct framework to guide an LLM in iteratively generating the workload and issue description from the anomaly definition. Specifically, the prompt for user request synthesis comprises three components:
- Task Overview instructs the LLM to reason step by step and generate the workload that exposes the specified anomaly, together with the corresponding user-issue description.
- Environment-Reset Skill guides the LLM in restoring the database to its initialized state when needed, preventing earlier changes from affecting subsequent validation.
- Sample-Relevant Information specifies the hardware configuration (CPU, memory, etc.), the DBMS (PostgreSQL [26] or MySQL [21]), the database instance and associated schema (TPCH [33], TPC-DS [32], or IMDB [15]), and the anomaly definition.
In particular, “Task Overview” specifies three constraints on workload generation to extend database agent evaluation beyond diagnosis and remediation to include performance optimization:
- Workload execution time should exceed one minute, preferably through complex analytical queries, to provide scope for workload execution-time optimization.
- Workload execution consistency requires the workload to produce consistent results across repeated executions, enabling equivalence checks between the original user workload and the workload optimized by database agents.
- Workload performance optimization could be feasible through techniques such as index recommendation, SQL rewriting, etc.
Guided by this prompt, the LLM can choose between the following two actions during iterative reasoning to generate and refine the anomaly-verified workload and user-issue description:
- Verify Action leverages a workload verifier to execute the candidate workload repeatedly, collect execution results and latencies, and determine whether the workload satisfies the above constraints. The above verifications are returned as observations to guide subsequent refinement and action selection.
- Finish Action terminates the synthesis process and outputs the finalized anomaly-verified workload and user-issue description once the observations satisfy the verification criteria.
4.3 Database Modification Synthesis
To assess whether database agents can resolve anomalies without making additional unnecessary changes to the database or altering the original semantics of the user request, we require the SELECT queries in the anomaly-verified workload to return non-empty results, supporting workload consistency assessment based on comparisons of pre- and post-remediation execution results. Moreover, some anomaly scenarios require specific data distributions (e.g., concentrating orders on a single buyer so that concurrent payment transactions compete for locks on the same rows), thereby necessitating targeted modifications to the given database instances as well as enhancing their diversities across anomaly samples.
To this end, we synthesize database modification operations through iterative reasoning and interaction within the ReAct framework, with its prompt consisting of the following components:
- Task Overview guides the LLM’s step-by-step reasoning and action selection for synthesizing database modification operations.
- Environment-Reset Skill and Sample-Relevant Information remain unchanged from their counterparts in Section 4.2.
- User Request provides the user-issue description and associated anomaly-verified workload synthesized in Section 4.2.
Guided by the prompt and available observations, the LLM selects one of the following two actions at each reasoning iteration:
- Query Action takes one of two forms: (i) executing queries to inspect relevant data characteristics of the target database instance, such as whether any rows satisfy a specified predicate; or (ii) executing candidate modification workloads to assess their feasibility. In both cases, the execution results are returned as observations to guide subsequent reasoning and action selection.
- Finish Action finalizes and outputs the database modification operations once accumulated observations indicate that the instance satisfies the target conditions. Additionally, the LLM also summarizes the updated database characteristics most relevant to the anomaly definition and user request in natural language, forming part of the input to the anomaly-injection stage (e.g., identifying two hotspot rows accessed by the workload to guide the construction of a concurrent transaction that acquires their locks in reverse order to reproduce deadlock-induced failures).
4.4 Anomaly Injection Synthesis
After synthesizing the database modification operations, we proceed to the final and most critical stage: anomaly-injection script synthesis. As in the preceding stages, we utilize a ReAct-based LLM to construct and refine the script through successive rounds of reasoning and interaction. To guide this process, the prompt for synthesizing anomaly-injection scripts is structured as follows:
-
Task Overview guides the LLM in constructing and validating an anomaly-injection script through step-by-step reasoning and action selection. Notably, since the self-contained environment supports operating-system-level operations that may be not occurred in real-world scenarios, we restrict anomaly injection to DBMS-level operations that simulate business logic.
-
Environment-Reset Skill, Sample-Relevant Information, and User Request retain the same content as in Section 4.3.
-
Database Feature Summary describes the updated database's sample-relevant data distributions presented in Section 4.3.
Guided by the prompt, the LLM iteratively constructs the anomaly-injection script through selecting one of the following two actions:
-
Evaluation Action submits the candidate anomaly-injection script to an anomaly evaluator, which evaluates the script following three steps: (i) executing the user workload in the initialized self-contained environment and recording its baseline performance; (ii) running the script to inject the anomaly; and (iii) rerunning the same user workload to check for performance degradation or execution errors, with the evaluation logs returned as observations to guide subsequent script refinement.
-
Finish Action returns the final anomaly-injection script when the collected evidence indicates that the target anomaly has been successfully induced, resulting in observable performance degradation or execution errors in the anomaly-verified workload.
5 INCIDENT-GUIDED ANOMALY REPRODUCTION
To enhance the realism and source diversity of DIAGDBENCH, we propose the Incident-Guided Anomaly Reproduction framework, which reconstructs complete anomaly sample end to end from real-world online diagnosis records collected within the enterprise.
5.1 Anomaly Sample Source
We collected conversation records of online diagnosis incidents submitted to DBAs in enterprise environments during May–July 2026 as source material for anomaly sample reconstruction, with the record structure detailed in Table 3. Alongside operational anomalies in DBMSs, the collected records contain requests outside the scope of database diagnosis, such as front-end platform issues, authorization requests, etc. Therefore, we applied the following filters, retaining 1,086 records for incident-guided anomaly reproduction:
-
Knowledge-Inquiry Filtering excludes those incidents whose surface symptom field is explicitly marked as an inquiry.
-
Platform-Issue Filtering removes the records assigned to the platform-related category in root cause field, such as platform functionality, user interface interaction, and infrastructure issues outside the scope of DBMS operation and diagnosis.
Table 3: Field definitions of real-world online diagnosis incident records collected from enterprise.
| Field Name | Field Description |
|---|---|
| Incident Name | Brief title of the user request. |
| Severity Level | Operational severity of the reported issue (e.g., critical, high, medium, or low). |
| Responsible Party | Optional information identifying who is accountable for the incident. |
| Surface Symptom | An operation- or service-level label derived from the user request, such as Data Manipulation Language (DML), Data Definition Language (DDL), or resource management, rather than a specific failure symptom. |
| Root Cause | A rule-derived candidate anomaly category (e.g., workload execution, resource bottlenecks, or DBMS configuration), rather than a verified root cause. |
| Diagnostic Evidence | Specific evidence collected while addressing the user request, comprising a key message, its interpretation, and the method used to localize the issue. |
| Category Analysis | Free-text description compiled from incident summaries, messages, and diagnostic evidence to support root-cause category assignment. |
| Incident Summary | A structured overview of the incident, involving observed symptoms, affected users, investigation progress, and the reported conclusion. |
-
Instance-Life-Cycle Filtering excludes records whose root cause category identifies instance-management operations, such as instance creation, capacity expansion, or database migration.
-
Information-Sufficiency Filtering removes records lacking key attributes or sufficient descriptive detail to identify their specific database anomaly category.
5.2 Single-Stage Anomaly Reproduction
Each online diagnosis incident record provides a detailed, concrete description of an anomaly sample, supplying explicit context that reduces reliance on speculative inference and helps mitigate hallucination during LLM inference. Building on the preceding three-stage synthesis pipeline, we adopt a simplified, single-stage process to jointly construct and refine interdependent sample components through multi-turn interaction, thereby accelerating construction while maintaining consistency with the recorded incident.
To guide the LLM in interpreting the collected incidents and constructing complete anomaly samples consistent with the source records, we incorporate additional skills tailor to the incident record into the input prompt, which comprises the following components:
-
Task Overview guides the LLM through step-by-step reasoning to construct a complete anomaly sample based on the incident.
-
Environment-Reset Skill remains the same as in Section 4.2.
-
User-Request Interpretation Skill clarifies record fields and maps reported issues to common anomaly definitions. It also specifies the operational scope of self-contained environment: lock contention, query plan degradation, and database resource pressure are reproducible, whereas platform- and infrastructure-level incidents (e.g., production network failures and resource scheduling faults) can only be approximated through database-visible effects. Reported symptoms for evaluator check are classified as performance degradation, blocking timeout, or execution error.
• Executable Scenario Construction Skill guides the LLM in converting real-world online diagnosis incident records into standardized, executable, and measurable anomaly sample components, and provides detailed instructions for anomaly validation.
• Reproduction Protocol Skill defines the output specifications and the final validation criteria. Each sample must pass the evaluator checks derived from the online diagnosis record and include all five components: an anomaly scenario definition, a user-issue description, an anomaly-verified workload, database modification operations, and an anomaly-injection script.
• Sample-Relevant Information contains the hardware configuration, DBMS, database instance and its schema, and specific incident record with relevant components described in Table 3.
Anomaly reproduction primarily follows the multi-turn ReAct framework described in Section 4.4, in which the LLM selects between the “Evaluation Action” and “Finish Action”. When the LLM selects the “Evaluation Action”, the anomaly evaluator validates the candidate sample and returns execution logs as observations to guide subsequent refinement of the relevant output components. This process continues until the LLM chooses the “Finish Action”.
6 DIAGDBENCH FOR DATABASE DIAGNOSIS
Leveraging this anomaly construction framework, we establish DiAGDBENCH for interactive evaluation of database agents on anomaly diagnosis, remediation, and workload performance optimization.
6.1 Benchmark Preparation
Building on 3,332 anomaly definitions and 1,086 online diagnosis records, we utilize the framework described in Sections 4 and 5 constructing 8,836 candidate anomaly samples across different DBMSs at scale. To promote linguistic diversity, we employ four LLMs for synthesis: GPT-5.5 [24], o3 [23], GLM-5.2 [39], and DeepSeek-V4-Pro [4]. Meanwhile, we allow up to 20 iterations per construction stage while retaining the default setting of the underlying LLM.
Although an evaluator checks anomaly-injection success during sample construction, its observations primarily guide subsequent LLM reasoning rather than mandatory instructions to further refinement after failure. Moreover, we observed that, for some samples, the LLM reached the iteration limit without issuing the “Finish Action”, leaving synthesis completion unconfirmed. Therefore, we filter the constructed samples using anomaly evaluator presented in Section 4.4, excluding those whose anomaly-verified workloads exhibit no substantial performance change after injection. Following anomaly validity filtering, we retain 7,394 valid samples in total.
From this pool, we curate challenging candidates for expert review to establish a high-quality, independent held-out test set for database agent evaluation. For each sample, we first measure the anomaly-verified workload's normal-operation runtime , then employ an o3-based ReAct database agent to diagnose and remediate the injected anomaly, after which we rerun the workload and record its execution time . Failed executions and timeouts are assigned . We rank samples in descending order of that prioritizes greater residual performance degradation or failure to restore successful workload execution, selecting the top 600 candidates across DBMSs and construction pipelines for expert annotation (Section 6.2). Expert review and refinement yield 454 held-out test samples, leaving 6,940 samples available for training.
For public release of the held-out test set, we package anomaly-injection scripts in a protected form to reduce the risk of agents identifying root causes through code inspection rather than database diagnosis. Meanwhile, the released artifacts preserve executable entry points compatible with the original evaluation workflow without directly exposing human-readable injection source code.
6.2 Expert Review
Following Section 6.1, we select 600 anomaly samples as candidates for a held-out test set to support unified database agent evaluation. Despite validity checks and difficulty-based agent selection, these LLM-generated samples may still differ from real-world incidents (e.g., claiming disk-full errors without reproducing storage exhaustion, or login failures when the injected anomaly merely slows down queries). We therefore invite a DBA with five years of experience diagnosing and resolving user-reported production database issues to review the candidates from four perspectives:
-
Anomaly Scenario Reasonability assesses whether each operation reflects business purposes, maintenance requirements, or plausible operational mistakes within a realistic scenario.
-
Trigger Mechanism Correctness checks whether anomaly injections conform to the target DBMS's execution rules without relying on operating-system-level interventions.
-
Script Executability and Configuration Effectiveness assesses whether the script executes successfully with its intended effects. Specifically, the DBA inspects logs and database state for execution errors and verifies that configuration changes apply to the intended connections throughout workload execution.
-
Consistency Between Anomaly Implementation and User Request checks whether the reported symptoms match the injection operations and observed behavior. Unsupported claims, such as stating with database deletion when none occurred or query timeouts with completed execution, are corrected or removed.
Beyond these checks, the DBA may propose optional refinements that increase diagnostic difficulty based on the original anomaly injection mechanism, prioritizing related concurrent operations rather than simply increasing workload intensity or waiting times.
For the 600 selected anomaly samples, together with their corresponding anomaly-verification logs and collected system metrics, the DBA may approve samples satisfying the above criteria, discard low-quality samples, or recommend revisions for those worth retaining, organizing any revision feedback into three components:
-
Anomaly Double Check records unresolved validity concerns and required verifications, such as checking whether an anomaly-injection timeout due to insufficient execution budget was incorrectly treated as evidence of successful anomaly reproduction.
-
Anomaly Modification identifies operations that violate the above criteria and suggests corresponding targeted revisions.
-
Anomaly Refinement specifies additional anomaly injections, with supporting explanations, to increase diagnostic difficulty.
Guided by this, we leverage a ReAct agent powered by GPT-5.5 to repair and refine the anomaly samples, incorporating further DBA feedback iteratively until approval without additional changes.
Table 4: Overview statistics of DIAGDBENCH. Workload, Data Mod., and Anomaly Inj. report statement or operation counts (min / max / avg) for anomaly-verified workloads, database modifications, and anomaly-injection scripts.
| DBMS | Split | Workload | Data Mod. | Anomaly Inj. | Samples |
|---|---|---|---|---|---|
| PostgreSQL | Train | 1/450/44.29 | 0/118/1.65 | 1/373/23.43 | 3,644 |
| Test | 2/278/45.73 | 0/11/1.71 | 1/107/27.31 | 236 | |
| MySQL | Train | 1/314/31.29 | 0/57/0.95 | 0/181/14.85 | 3,296 |
| Test | 2/156/19.19 | 0/18/1.75 | 2/64/18.33 | 218 |
6.3 Statistical Analysis
DIAGDBENCH comprises 6,940 synthesized training samples and a separate held-out test set of 454 expert-annotated samples, with the specific components of each sample as follows:
-
Anomaly Definition provides a structured description of the target anomaly, including root-cause definition, observable symptoms, and injection success criteria where available.
-
Environment Configuration specifies hardware configuration, DBMS, database instance, and database connection information.
-
User-Issue Description describes the user-observed symptoms in natural language during workload execution.
-
Anomaly-Verified Workload denotes the SQL workload used to observe anomaly-injection effects and assess database agents in anomaly remediation and workload performance optimization.
-
Database Modification Operations comprise SQL operations that establish sample-specific data and schema prerequisites, with an empty file when no modifications are specified.
-
Anomaly-Injection Script is an executable script for establishing the target anomaly in the configured DBMS environment.
To promote environmental diversity, we construct anomaly samples for PostgreSQL and MySQL using three hardware configurations: (i) 4 CPUs, 4 GB RAM, a combined RAM-and-swap limit of 8 GB, and 64 GB storage; (ii) 8 CPUs, 8 GB RAM, a combined RAM-and-swap limit of 16 GB, and 128 GB storage; and (iii) 16 CPUs, 16 GB RAM, a combined RAM-and-swap limit of 32 GB, and 256 GB storage. Meanwhile, we import prebuilt database instances based on different schemas of TPC-H [33], TPC-DS [32], and IMDB [15] to provide the initial data. Additionally, DIAGDBENCH instantiated 7,394 distinct anomaly definitions from the sources in Sections 4.1 and 5.1 to enhance scenario diversity. Table 4 illustrates observable variation in the numbers of SQL statements in anomaly-verified workloads and database modifications, as well as operations in anomaly-injection scripts, highlighting structural diversity across samples beyond differences in their execution environments.
Compared with existing datasets and benchmarks, as presented in Table 5, DIAGDBENCH provides thousands of executable anomaly samples across diverse execution environments, enabling interactive database diagnosis, anomaly remediation and workload performance optimization while providing a foundation for training database agents to improve both capabilities. Notably, except the samples included in DIAGDBENCH, we provide an LLM-based anomaly sample construction framework with two complementary pipelines that enables users to generate customized samples from their own anomaly specifications. This framework supports the construction of simulated scenarios tailored to specific production environments and operational requirements, facilitating the iterative development and improvement of database agents.
6.4 Evaluation Metrics
Since DIAGDBENCH primarily targets interactive database anomaly remediation while also assessing diagnostic quality, we adopt two complementary evaluation protocols: Execution-Grounded Remediation Evaluation and LLM-Judged Diagnostic Report Evaluation. Specifically, we conduct standardized evaluation and scoring of the diagnostic reports, remediation scripts, and optional optimized anomaly-verified workloads submitted by database agents upon completion of the database diagnosis and anomaly remediation.
6.4.1 Execution-Grounded Remediation Evaluation. For each sample , we initialize a container according to its environment configuration and execute the original anomaly-verified workload to record the baseline results and latency . Then, we inject the anomaly and execute the agent-provided remediation script with DBA privileges. In the post-remediation environment, we execute the agent-provided optimized anomaly-verified workload, if available, or the original workload otherwise, recording results and latency . To this end, we define the remediation latency ratio as:
Since we encourage workload optimization during diagnosis and remediation, it is necessary to assess whether each optimized workload preserves the identical intent and observable semantics of the original user request. Comparing execution results alone cannot establish semantic equivalence, while volatile values (e.g., timestamps, random values, or generated identifiers) may introduce spurious mismatches. We therefore use an LLM judge [18, 42] to assess semantic equivalence based on the original and optimized workloads together with their execution results and . Specifically, the judge evaluates both workloads as complete, ordered sequences of statements, including query outputs, ordering requirements, and transaction state. Equivalence claims lacking sufficient evidence are rejected, and we define the binary semantic-equivalence indicator when the judge accepts equivalence and otherwise.
Finally, we evaluate anomaly remediation in terms of execution success, workload semantic equivalence, and post-remediation performance. A binary execution-validity indicator equals 1 if the post-remediation workload completes without errors and its latency is less than eight times the normal baseline latency (), and 0 otherwise. Using , , and , we then compute the anomaly remediation score for each sample on a scale of 0 to 100 as follows:
Conditional on , matching the normal baseline latency yields 80 points. Higher scores indicate improved workload performance, whereas lower scores reflect residual slowdown. A score of zero is assigned when workload execution encounters errors or post-remediation latency is at least eight times the baseline.
Table 5: Comparison of database diagnosis datasets. Note: "WPO Eval. Support" denotes workload performance optimization evaluation support; "Training and Test Sources" reports anomaly-definition counts. "-" indicates unreported counts or inapplicable settings; "***" marks static samples, such as time-series metrics or diagnostic records for LLM supervised fine-tuning.
| Benchmark | # Hardware Configs | # DBMSs | # Schemas | # Training Sources | # Test Sources | Interactive Operation Support | WPO Eval. Support |
|---|---|---|---|---|---|---|---|
| DBPA [9] | 4 | 2 | 4 | 9* | 9* | No | No |
| D-Bot [45] | - | 1 | 3 | 2,819* | 539 | No | No |
| DBA-Bench [2] | - | 2 | - | - | 241 | Yes | No |
| DIAGDBENCH | 3 | 2 | 3 | 6,940 | 454 | Yes | Yes |
6.4.2 LLM-Judged Diagnostic Report Evaluation. An LLM judge evaluates each diagnostic report against the original anomaly sample, comprising its ground-truth anomaly definition, user-issue description, anomaly-verified workload, and anomaly-injection script, scoring each of the following four dimensions on a 0–100 scale:
-
Root-Cause Accuracy () assesses whether the diagnostic report accurately identifies the injected root causes and reconstructs their corresponding causal chain.
-
Evidence-Grounded Reasoning () assesses whether the report provides rigorous, internally consistent reasoning supported through observed symptoms and available evidence.
-
Remediation Appropriateness () assesses whether the proposed actions are technically executable and address the anomaly without unnecessary operations.
-
Operational Safety () assesses whether the actions are confined to the scope of the user request, thereby avoiding unintended harm to unrelated data or database operations.
For each sample , the diagnostic report score aggregates the four dimension scores using the following weights:
6.4.3 Overall Score. For each sample , we compute the overall score as a weighted sum of the remediation and diagnostic report scores, prioritizing anomaly remediation effectiveness:
For each method , we compute its final score by averaging the sample-level scores over the evaluated subset of the test set:
7 EXPERIMENTS
In this section, we present a detailed evaluation of different database agents on the 454-sample held-out test set of DIAGDBENCH.
7.1 Experimental Setup
7.1.1 Baselines. We provide all database agents with a standardized prompt template comprising the following three components:
-
Task Overview guides step-by-step LLM reasoning and action selection for database diagnosis and anomaly remediation. It also encourages performance optimization through semantics-preserving rewrites of the anomaly-verified workload or tuning operations incorporated into the remediation code.
-
Sample-Relevant Information specifies hardware configuration, database instance, DBA credentials, and the user request with an issue description and an anomaly-verified workload.
-
Output Format requires database agents to submit a diagnostic report, remediation code, and an optional optimized workload.
Specifically, we evaluate eight LLM-based database agents while retaining the default hyperparameter settings of their underlying LLMs, and the architectures of these agents are described as follows:
ReAct-based Database Agents We instantiate five database agents using the ReAct [37] framework with GPT-6 Astra [25], Qwen3.8-Max [28], DeepSeek-V4.1-Flash [5], Kimi K3 [13], and GLM-5.3-Flash [40] as the underlying models. Each database agent is limited to 20 interactions per sample, and at each reasoning iteration, the LLM can choose between the following two actions:
-
Code Action generates a Bash script that is executed within the sample container for database inspection, anomaly remediation, or workload validation, with the execution output returned as an observation to guide subsequent reasoning and action selection.
-
Finish Action concludes the interaction with a diagnostic report, reusable remediation code, and an optional optimized workload.
Codex-based Database Agent We evaluate the Codex [1] scaffold with GPT-6 Astra using its native agent loop and Model Context Protocol (MCP) tools. Specifically, we supplement the standardized inputs with tool definitions and interaction instructions: executes diagnostic and remediation scripts within the sample container and returns observations; submits the diagnostic report, remediation code, and optional optimized workload. Each sample allows at most 20 database-tool actions.
D-Bot [45] We evaluate D-Bot with GPT-6 Astra for PostgreSQL diagnosis using its native multi-expert workflow, which dynamically assigns specialized agents to retrieve monitoring tools and expert knowledge, investigate candidate root causes through tree-search reasoning and reflection, and cross-review findings before generating final report. We supplement standardized inputs with 12 monitoring snapshots collected over time from the sample environment, such as resource utilization, database statistics, and blocking relationships. Since native D-Bot produces diagnostic findings and recommendations rather than executable remediation code, a separate LLM-based adapter generates a remediation script and an optional optimized anomaly-verified workload from its finalized report. We retain the implemented search settings: two simulations per expert and a maximum depth of 24 steps per search chain.
DBAIOps [44] We evaluate DBAIOps with GPT-6 Astra using its implemented knowledge-based question-answering workflow. Given standardized inputs and a read-only sample-environment snapshot, DBAIOps queries an external knowledge-base service and augments the LLM input with retrieved material to generate a diagnostic report without iterative observation or remediation. A
Table 6: Evaluation scores of eight database agents on DIAGDBENCH. Each cell reports the mean score over the corresponding samples, using the agent-proposed optimized workload when available and the original anomaly-verified workload otherwise. D-Bot's Overall score includes only the 236 PostgreSQL samples, as it does not support MySQL (-).
| DIAGDBENCH | ReAct | Codex | D-Bot | DBAIOps | ||||
|---|---|---|---|---|---|---|---|---|
| GPT-6 Astra | GLM-5.3 Flash | Kimi K3 | DeepSeek-V4.1 Flash | Qwen3.8 Max | GPT-6 Astra | GPT-6 Astra | GPT-6 Astra | |
| PostgreSQL | 56.81 | 41.43 | 39.40 | 42.25 | 43.64 | 53.62 | 20.09 | 23.27 |
| MySQL | 55.61 | 44.58 | 46.01 | 43.98 | 46.31 | 51.22 | - | 11.03 |
| Overall | 56.24 | 42.97 | 42.65 | 43.10 | 44.92 | 52.44 | 20.09 | 20.55 |
separate LLM call converts the finalized report into a remediation script and an optional optimized workload, preserving the native diagnostic workflow. Bounded retries handle retrieval and model-request failures, incomplete responses, and invalid artifact formats without constituting additional database diagnosis rounds.
7.1.2 Evaluation Settings. Database agents are evaluated according to the scoring procedures in Section 6.4. Specifically, each workload evaluation comprises one warm-up run followed by five timed runs. The median latencies before anomaly injection and after remediation define as and , from which we compute the remediation latency ratio . We use GPT-6.1 Sol [22] as the judge for both workload semantic-equivalence assessment and diagnostic report evaluation. For the former, we obtain three valid binary judgments through separate evaluations and determine by majority voting [8, 35]. For the latter, we conduct three scoring rounds and define as the median of the resulting weighted scores.
7.2 Main Results
Table 6 presents assessment results for eight database agents on DIAGDBENCH, with the key findings as follows:
DIAGDBENCH remains challenging even for frontier LLMs paired with agent scaffolds. Experimental results demonstrate that the ReAct-based database agent with GPT-6 Astra achieves the highest overall score among the eight database agents, reaching 56.24 out of 100. Apart from GPT-6 Astra paired with ReAct or Codex, other approaches score below 47 on each supported DBMS, highlighting the challenges of accurate diagnosis, effective remediation, and workload performance optimization on DIAGDBENCH.
Database-specific diagnosis approaches achieve degraded evaluation scores on DIAGDBENCH. D-Bot and DBAIOps employ knowledge-augmented diagnostic workflows primarily designed for diagnostic reports generation. Although we use an LLM to translate these reports into remediation scripts, D-Bot scores 20.09 on its supported PostgreSQL samples, while DBAIOps achieves 20.55 on the full test set. These observed performance suggests that directly translating diagnostic reports into effective remediation actions remains challenging, further motivating the significance of interactive remediation that enables database agents to incorporate execution feedback, refine their actions, and verify recovery.
Database diagnosis and remediation performance varies across LLM backbones and agent scaffolds. With the ReAct framework, input prompts, and available tools held fixed, GPT-6 Astra outperforms the second-best model, Qwen3.8 Max, by 11.32 points in overall score. Meanwhile, with GPT-6 Astra as the fixed underlying model, ReAct achieves a higher overall score than Codex, reaching 56.24 compared with 52.44. These results underscore the importance of both the underlying LLM and the surrounding agent harness in enhancing the capability of database agent.
Stronger performance on specific DBMS does not necessarily translate into an advantage on others. Within the ReAct scaffold, Kimi K3 scores 39.40 on PostgreSQL and 46.01 on MySQL, whereas DeepSeek-V4.1 Flash achieves 42.25 and 43.98, respectively. This reversal in their relative ranking demonstrates that overall scores alone do not fully capture the models' distinct strengths across anomaly scenarios instantiated on different DBMSs.
7.3 Detailed Analysis
We exclude successful recoveries with remediation latency ratios and analyze the remaining samples in Figure 2. Specifically, we report error-category proportions among failed recoveries and successful recoveries with , alongside optimization-operation prevalence among successful recoveries with .
7.3.1 Error Analysis. Each error case is assigned one of the following outcome-based labels: Missing Submission (E1; failure to submit expected and complete outcomes within the maximum iteration), Workload Execution (E2; anomaly-verified workload execution fails or times out), Semantic Rejection (E3; the semantic judge rejects equivalence between the original and optimized workloads), Residual Slowdown (E4; execution and functional validation succeed, but performance remains degraded with ), or Other (E5). Figure 2(a) illustrates the following recurring failure patterns:
-
Workload Execution Bottleneck. Workload execution failures constitute the most or second-most prevalent error category for most database agents, highlighting the persistent challenge of effective remediation for the anomaly samples in DIAGDBENCH.
-
Incomplete Performance Recovery. Residual Slowdown accounts for 56.2% and 52.8% for ReAct and Codex with GPT-6 Astra, respectively, with substantial proportions also observed across other agents. Despite explicit instructions to optimize the execution performance of the anomaly-verified workload, database agents typically focus on addressing the primary root-cause actions without sufficiently validating end-to-end performance, thereby leaving residual performance bottlenecks unresolved.
-
Challenges in semantics-preserving workload rewriting. Beyond limitations in diagnostic capabilities, some agents struggle in producing optimized workload rewrites that satisfy semantic-equivalence validation, thereby resulting in unexpected failures even after the primary anomaly has been resolved.
| ReAct GPT-6 Astra | 0.0% | 31.8% | 11.5% | 56.2% | 0.5% |
|---|---|---|---|---|---|
| ReAct GLM-5.3 Flash | 17.5% | 34.5% | 24.2% | 23.2% | 0.5% |
| ReAct Kimi K3 | 32.0% | 23.6% | 8.9% | 35.5% | 0.0% |
| ReAct DeepSeek-V4.1 Flash | 26.1% | 19.9% | 16.5% | 37.5% | 0.0% |
| ReAct Qwen3.8 Max | 12.1% | 30.4% | 12.6% | 44.4% | 0.5% |
| Codex GPT-6 Astra | 1.5% | 38.1% | 7.1% | 52.8% | 0.5% |
| D-Bot GPT-6 Astra | 0.0% | 54.8% | 14.3% | 31.0% | 0.0% |
| DBAIOps GPT-6 Astra | 0.0% | 62.5% | 15.2% | 21.8% | 0.5% |
| E1 Missing Submission | E2 Workload Execution | E3 Semantic Rejection | E4 Residual Slowdown | E5 Other |
(a) Error Analysis
| 6.2% | 12.5% | 12.5% | 68.8% | 12.5% |
|---|---|---|---|---|
| 20.0% | 46.0% | 4.0% | 60.0% | 4.0% |
| 5.9% | 52.9% | 17.6% | 47.1% | 5.9% |
| 13.7% | 23.5% | 7.8% | 70.6% | 11.8% |
| 7.1% | 23.2% | 17.9% | 69.6% | 8.9% |
| 0.0% | 9.1% | 0.0% | 81.8% | 9.1% |
| N/A | N/A | N/A | N/A | N/A |
| N/A | N/A | N/A | N/A | N/A |
| O1 Workload Rewrite | O2 Index Recommend | O3 Database Maintenance | O4 Knob Tuning | O5 Other |
(b) Workload Optimization Analysis
Figure 2: Detailed analysis of database diagnosis evaluations. Rows correspond to database agents, while columns denote error categories (left) and optimization categories (right). Note that O1–O4 may overlap because a sample can involve multiple optimization operations. D-Bot and DBAIOps are marked N/A because neither has eligible cases for this analysis.
7.3.2 Workload Optimization Analysis. Among successful recoveries with , we identify five categories of performance optimization as follows: Workload Rewrite (O1); workload modifications accepted as semantically equivalent), Index Recommend (O2), Database Maintenance (O3; statistics updates and table or index maintenance), Knob Tuning (O4), and Other (O5). Figure 2(b) reveals the characteristics of the optimization behavior as follows:
- Diverse Optimization Strategies. Database agents adopt various strategies for workload performance optimization, with an average speedup of 4.42x, thereby further mitigating residual slowdowns beyond simply restoring workload functionality.
- Dominant Tuning Operations. Knob tuning is the most prevalent operation across most database agents, appearing in 47.1%–81.8% of these samples, while index recommendation accounts for 9.1%–52.9%. These results suggest that frontier-LLM-based database agents can leverage conventional database configuration and indexing knowledge for workload performance optimization.
- Potential for Semantics-Preserving Rewriting. Compared with failed samples due to semantic-equivalence violation, successful cases satisfy this requirement while achieving substantial latency reductions, thereby motivating further improvements in database agents' ability to enhance execution efficiency while reliably preserving the original workload's semantics.
7.4 Case Study
Figure 3 illustrates the interactive database diagnosis and remediation of an anomaly in an IMDB-based PostgreSQL environment using the ReAct agent powered by GPT-6 Astra.
Anomaly Sample. In the PostgreSQL database IMDB, supporting movie-content management and analytics, an injected long-lived transaction and recurring background workloads cause blocking and performance degradation. Specifically, users encounter workload-wide slowdowns and transaction stalls when executing a mixed workload combining five write-and-confirm transactions with four analytical queries over large shared tables. These disruptions stem from an uncommitted transaction blocking DDL, thereby
queuing subsequent readers, alongside four recurring bulk-update clients and eight analytical clients operating under restrictive database knobs. Together, these conditions combine lock-induced blocking, constrained query execution, and sustained resource contention between foreground transactions and background analytics.
Database Diagnosis. Across ten iterations, the agent followed a conventional DBA workflow by inspecting locks, performing query and session cleanup, and refreshing statistics, yielding modest performance gains. Despite identifying recurring updates, four iterations of session-level diagnosis and backend cleanup failed to manage upstream submissions, leaving remediation incomplete.
Beyond this failure, the “Human Database Administrator Remarks” in Figure 3 highlight three operational shortcomings: (i) terminating active sessions risks disrupting ongoing work, whereas transaction completion and DDL execution should be coordinated with workload owners (R1); (ii) repeatedly removing replacement connections addresses transient symptoms rather than tracing recurring updates to their submitting source and regulating workload intensity according to resource demand (R2); and (iii) when unexpected slowdowns persist, DBAs routinely inspect DBMS knobs and concurrent resource usage to address residual bottlenecks rather than treating symptom removal as sufficient recovery (R3).
Discussion. In practice, production DBMSs routinely support numerous concurrent sessions, requiring DBAs to resolve user-visible disruptions while coordinating ongoing workloads and maintaining system-wide performance. However, existing database agents struggle to diagnose complex anomalies and coordinate interdependent sessions while preserving scheduling dependencies and using shared resources efficiently. Even after successful anomaly remediation, they tend to finish diagnosis once the superficial blocking is resolved, without systematically checking for residual performance bottlenecks. Reliable database agents must therefore integrate business-aware workload coordination with system-wide performance optimization to restore functionality and expected performance rather than merely alleviate symptoms, which motivates further research into developing and refining these capabilities.

Figure 3: Case study of a ReAct agent with GPT-6 Astra. Following environment setup through database import, sample-specific modifications, and anomaly injection, database agent perform interactive diagnosis and remediation with user-issue description and anomaly-verified workload, ultimately outputting diagnostic report, remediation script, and optional optimized workload.
8 RELATED WORK
8.1 Database Anomaly Benchmarks
DBPA [9] defines nine common anomalies and reproduction procedures, collects monitoring metrics, and synthesizes compound anomalies to construct training and test sets for root cause classification. More recently, DBA-Bench [2] provides 241 production-fidelity diagnosis samples for PostgreSQL and TiDB, evaluating database agents through multi-turn interactions with live databases, but offers limited samples without separate training data. In contrast, DIAGDBENCH provides 454 held-out evaluation samples and thousands of training samples across diverse environmental settings.
8.2 Database Diagnosis
Traditional Methods Early studies predominantly formulate database diagnosis into root cause classification through rule-based or machine-learning-based methods. DBSherlock [38] maps structured anomaly predicates extracted from monitoring metrics to a DBA-informed causal graph, ranking candidate root causes and generating causal explanations through backward symptom tracing and rule-based pruning of infeasible paths. iSQUAD [19] focuses on diagnosing intermittent slow queries (iSQ) in cloud databases through extracting typed key performance indicators anomaly patterns, then removing redundant dependencies, and grouping similar iSQs by type-oriented pattern integration clustering. A Bayesian case model is subsequently used to characterize each cluster, substantially reducing labeling overhead while enabling online root-cause diagnosis of incoming iSQs. AutoMonitor [12] identifies anomalous metric windows using Long Short-Term Memory (LSTM) reconstruction errors, detects metrics with significant distributional shifts via the Kolmogorov-Smirnov test, and matches similar historical anomalies using a weighted K-Nearest Neighbors (KNN) model.
LLM-based Methods. D-Bot [45] integrates anomaly monitoring, profiling, diagnosis, and report generation within a multi-agent
framework, with GaussMaster [43] extending this paradigm to open-Gauss. Given anomaly metrics, it retrieves documentation and tools from knowledge base, combining tree-search reasoning, reflection, and cross-agent review for report summarization. Panda [31] supports performance debugging through global and instance-specific contextual grounding, evidence-based response verification, risk-and impact-aware action assessment, and feedback-driven historical case integration. DBAIOps [44] explores and expands diagnostic paths in heterogeneous knowledge graphs encoding DBA expertise, supplying retrieved reasoning chains and anomalous metrics to an LLM for root-cause analysis and remediation recommendations.
Despite the availability of D-Bot's public dataset, early LLM-based approaches lacked a unified benchmark for evaluating interactive diagnosis in live DBMSs. DIAGDBENCH addresses this gap with diverse, executable samples and separate training and held-out evaluation sets, enabling unified assessment of diagnostic accuracy, remediation effectiveness, and optional workload optimization.
9 CONCLUSION
We introduce DIAGDBENCH for training and evaluating database agents on interactive database diagnosis, anomaly remediation, and optional workload performance optimization. DIAGDBENCH simulates diverse, realistic anomaly samples in self-contained, executable DBMS environments spanning three hardware configurations, two DBMSs, and three database schemas. To construct anomaly samples at scale, we propose an LLM-based framework with two complementary pipelines: Manual-Guided Anomaly Synthesis, grounded in DBA manuals and official DBMS documentation, and Incident-Guided Anomaly Reproduction, derived from real-world enterprise online diagnosis records. Built using these pipelines, DIAGDBENCH comprises 6,940 synthesized training samples and a held-out test set of 454 expert-annotated samples. Experimental evaluations across multiple database agents reveal persistent performance limitations, underscoring the challenges posed by DIAGDBENCH.
REFERENCES
[1] Nicolas Bonamy and Derrick Choi. 2026. Codex as a Platform: Build on the Open Agent Harness. https://developers.openai.com/blog/codex-as-a-platform.
[2] Junming Chen, Junyang Jiang, Xu Chen, Zibo Liang, and Kai Zheng. 2026. DBA-Bench: A Production-Fidelity Benchmark for LLM-Based Database Operations Agents. arXiv:2607.22165 [cs.DB] https://arxiv.org/abs/2607.22165
[3] Tianyu Cui, Shiyu Ma, Ziang Chen, Tong Xiao, Shimin Tao, Yilun Liu, Shenglin Zhang, Duoming Lin, Changchang Liu, Yuzhe Cai, Weibin Meng, Yongqian Sun, and Dan Pei. 2024. LogEval: A Comprehensive Benchmark Suite for Large Language Models In Log Analysis. arXiv:2407.01896 [cs.CL] https://arxiv.org/abs/2407.01896
[4] DeepSeek-AI. 2026. DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence. https://arxiv.org/abs/2606.19348.
[5] DeepSeek-AI. 2026. DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression. https://arxiv.org/abs/2609.19969.
[6] Docker, Inc. Docker. https://www.docker.com/. Accessed: 2026-10-08.
[7] Songqiao Han, Xiyang Hu, Hailiang Huang, Mingqi Jiang, and Yue Zhao. 2022. ADBench: Anomaly Detection Benchmark. arXiv:2206.09426 [cs.LG] https://arxiv.org/abs/2206.09426
[8] Jiaxin Huang, Shixiang Shane Gu, Le Hou, Yuexin Wu, Xuezhi Wang, Hongkun Yu, and Jiawei Han. 2022. Large language models can self-improve. arXiv preprint arXiv:2210.11610 (2022).
[9] Shiyue Huang, Ziwei Wang, Xinyi Zhang, Yaofeng Tu, Zhongliang Li, and Bin Cui. 2023. DBPA: A Benchmark for Transactional Database Performance Anomalies. Proc. ACM Manag. Data 1, 1, Article 72 (May 2023), 26 pages. doi:10.1145/3588926
[10] Xinmei Huang, Haoyang Li, Jing Zhang, Xinxin Zhao, Zhiming Yao, Yiyan Li, Tieying Zhang, Jianjun Chen, Hong Chen, and Cuiping Li. 2025. E2ETune: End-to-End Knob Tuning via Fine-Tuned Generative Language Model. Proc. VLDB Endow. 18, 13 (Sept. 2025), 5540–5554. doi:10.14778/3773731.3773732
[11] Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik Narasimhan. 2024. SWE-bench: Can Language Models Resolve Real-World GitHub Issues? arXiv:2310.06770 [cs.CL] https://arxiv.org/abs/2310.06770
[12] LI Guo-Liang JIN Lian-Yuan. 2021. AI-based Database Performance Diagnosis. Journal of Software 32, 3 (2021), 845–858. doi:10.13328/j.cnki.jos.006177
[13] Kimi Team. 2026. Kimi K3: Open Frontier Intelligence. https://arxiv.org/abs/2607.24653.
[14] Fangyu Lei, Jixuan Chen, Yuxiao Ye, Ruisheng Cao, Dongchan Shin, Hongjin Su, Zhaoqing Suo, Hongcheng Gao, Wenjing Hu, Pengcheng Yin, Victor Zhong, Caiming Xiong, Ruoxi Sun, Qian Liu, Sida Wang, and Tao Yu. 2025. Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflows. arXiv:2411.07763 [cs.CL] https://arxiv.org/abs/2411.07763
[15] Viktor Leis, Andrey Gubichev, Atanas Michev, Peter Boncz, Alfons Kemper, and Thomas Neumann. 2015. How good are query optimizers, really? Proceedings of the VLDB Endowment 9, 3 (2015), 204–215.
[16] Haoyang Li, Shang Wu, Xiaokang Zhang, Xinmei Huang, Jing Zhang, Fuxin Jiang, Shuai Wang, Tieying Zhang, Jianjun Chen, Rui Shi, Hong Chen, and Cuiping Li. 2025. OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale. arXiv:2503.02240 [cs.CL] https://arxiv.org/abs/2503.02240
[17] Xiao Liu, Hao Yu, Hanchen Zhang, Yifan Xu, Xuanyu Lei, Hanyu Lai, Yu Gu, Hangliang Ding, Kaiwen Men, Kejuan Yang, Shudan Zhang, Xiang Deng, Ao-han Zeng, Zhengxiao Du, Chenhui Zhang, Sheng Shen, Tianjian Zhang, Yu Su, Huan Sun, Minlie Huang, Yuxiao Dong, and Jie Tang. 2024. AgentBench: Evaluating LLMs as Agents. In The Twelfth International Conference on Learning Representations. https://openreview.net/forum?id=zAdUB0aCTQ
[18] Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. 2023. G-Eval: NLG Evaluation using GPT-4 with Better Human Alignment. arXiv:2303.16634 [cs.CL] https://arxiv.org/abs/2303.16634
[19] Minghua Ma, Zheng Yin, Shenglin Zhang, Sheng Wang, Christopher Zheng, Xin-hao Jiang, Hanwen Hu, Cheng Luo, Yilin Li, Nengjun Qiu, Feifei Li, Changcheng Chen, and Dan Pei. 2020. Diagnosing root causes of intermittent slow queries in cloud databases. Proc. VLDB Endow. 13, 8 (April 2020), 1176–1189. doi:10.14778/3389133.3389136
[20] Zeyao Ma, Bohan Zhang, Jing Zhang, Jifan Yu, Xiaokang Zhang, Xiaohan Zhang, Sijia Luo, Xi Wang, and Jie Tang. 2024. SpreadsheetBench: Towards Challenging Real World Spreadsheet Manipulation. arXiv:2406.14991 [cs.CL] https://arxiv.org/abs/2406.14991
[21] MySQL (DBMS). https://www.mysql.com/. Accessed: 2026-10-03.
[22] OpenAI [n.d.]. GPT-6.1 Sol. https://developers.openai.com/api/docs/models/gpt-6.1-sol. Accessed: October 16, 2026.
[23] OpenAI. 2025. o3. https://developers.openai.com/api/docs/models/o3.
[24] OpenAI. 2026. GPT-5.5. https://developers.openai.com/api/docs/models/gpt-5.5.
[25] OpenAI. 2026. GPT-6 Astra. https://developers.openai.com/api/docs/models/gpt-6-astra.
[26] PostgreSQL (DBMS). https://www.postgresql.org/. Accessed: 2026-10-03.
[27] Xiangfei Qiu, Zhe Li, Wanghui Qiu, Shiyan Hu, Lekui Zhou, Xingjian Wu, Zhengyu Li, Chenjuan Guo, Aoying Zhou, Zhenli Sheng, Jilin Hu, Christian S.
Jensen, and Bin Yang. 2025. TAB: Unified Benchmarking of Time Series Anomaly Detection Methods. arXiv:2506.18046 [cs.LG] https://arxiv.org/abs/2506.18046
[28] Qwen Team. 2026. Qwen3.8-Max: A New Bar for Coding and Cowork. https://qwen.ai/blog?id=qwen3.8.
[29] Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: 100,000+ Questions for Machine Comprehension of Text. arXiv:1606.05250 [cs.CL] https://arxiv.org/abs/1606.05250
[30] Stephen Robertson and Hugo Zaragoza. 2009. The probabilistic relevance framework: BM25 and beyond. Foundations and trends in information retrieval 4, 1-2 (2009), 1–174.
[31] Vikramank Singh, Kapil Eknath Vaidya, Vinayshekhar Bannihatti Kumar, Sopan Khosla, Murali Narayanaswamy, Rashmi Gangadharajah, and Tim Kraska. 2024. Panda: Performance debugging for databases using LLM agents. (2024). https://www.amazon.science/publications/panda-performance-debugging-for-databases-using-llm-agents
[32] Transaction Processing Performance Council (TPC). [n.d.]. TPC-DS: Decision Support Benchmark. Online. Available: http://www.tpc.org/tpcds/.
[33] Transaction Processing Performance Council (TPC). Year of the specification version. TPC-H Benchmark Specification. Online. Available: http://www.tpc.org/tpch/.
[34] Pengyi Wang, Sibei Chen, Ju Fan, Bin Wu, Nan Tang, and Jian Tan. 2025. Andromeda: Debugging Database Performance Issues with Retrieval-Augmented Large Language Models. In Companion of the 2025 International Conference on Management of Data (Berlin, Germany) (SIGMOD/PODS '25). Association for Computing Machinery, New York, NY, USA, 243–246. doi:10.1145/3722212.3725080
[35] Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. 2023. Self-Consistency Improves Chain of Thought Reasoning in Language Models. arXiv:2203.11171 [cs.CL] https://arxiv.org/abs/2203.11171
[36] Tianbao Xie, Danyang Zhang, Jixuan Chen, Xiaochuan Li, Siheng Zhao, Ruisheng Cao, Toh Jing Hua, Zhoujin Cheng, Dongchan Shin, Fangyu Lei, Yitao Liu, Yiheng Xu, Shuyuan Zhou, Silvio Savarese, Caiming Xiong, Victor Zhong, and Tao Yu. 2024. OSWorld: Benchmarking Multimodal Agents for Open-Ended Tasks in Real Computer Environments. arXiv:2404.07972 [cs.AI] https://arxiv.org/abs/2404.07972
[37] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. 2023. ReAct: Synergizing Reasoning and Acting in Language Models. arXiv:2210.03629 [cs.CL] https://arxiv.org/abs/2210.03629
[38] Dong Young Yoon, Ning Niu, and Barzan Mozafari. 2016. DBSherlock: A Performance Diagnostic Tool for Transactional Databases. In Proceedings of the 2016 International Conference on Management of Data (San Francisco, California, USA) (SIGMOD '16). Association for Computing Machinery, New York, NY, USA, 1599–1614. doi:10.1145/2882903.2915218
[39] Zai. 2026. GLM-5.2. https://docs.zai GUIDES/llm/glm-5.2.
[40] Zai. 2026. GLM-5.3-Flash: Frontier Intelligence, Flash Cost. https://z.ai/blog/glm-5.3-flash.
[41] Xinxin Zhao, Xinmei Huang, Haoyang Li, Jing Zhang, Shuai Wang, Tieying Zhang, Jianjun Chen, Rui Shi, Cuiping Li, and Hong Chen. 2026. LLMIA: An Out-of-the-Box Index Advisor via In-Context Learning with LLMs. arXiv:2503.07884 [cs.DB] https://arxiv.org/abs/2503.07884
[42] Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric P. Xing, Hao Zhang, Joseph E. Gonzalez, and Ion Stoica. 2023. Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. arXiv:2306.05685 [cs.CL] https://arxiv.org/abs/2306.05685
[43] Wei Zhou, Ji Sun, Xuanhe Zhou, Guoliang Li, Luyang Liu, Hao Wu, and Tianyuan Wang. 2025. GaussMaster: An LLM-based Database Copilot System. arXiv:2506.23322 [cs.DB] https://arxiv.org/abs/2506.23322
[44] Wei Zhou, Peng Sun, Xuanhe Zhou, Qianglei Zang, Ji Xu, Tieying Zhang, Guoliang Li, and Fan Wu. 2025. DBAIOps: A Reasoning LLM-Enhanced Database Operation and Maintenance System using Knowledge Graphs. arXiv:2508.01136 [cs.DB] https://arxiv.org/abs/2508.01136
[45] Xuanhe Zhou, Guoliang Li, Zhaoyan Sun, Zhiyuan Liu, Weize Chen, Jianming Wu, Jiesi Liu, Ruohang Feng, and Guoyang Zeng. 2023. D-Bot: Database Diagnosis System using Large Language Models. arXiv:2312.01454 [cs.DB] https://arxiv.org/abs/2312.01454