Introduction
Database index selection is a classic "Goldilocks" problem in relational database management: too few indexes result in sluggish query performance, while an excessive number consumes storage and degrades data update speeds. Traditional approaches to this problem typically fall into two categories: heuristic-based advisors (e.g., Extend or Drop), which are often slow and prone to "index regression" due to inaccurate optimizer estimates, and learning-based advisors (e.g., Reinforcement Learning), which require extensive training data and often fail to generalize to new database schemas.
AMAZe (MAAdvisor) introduces a zero-shot index advisor framework that leverages the reasoning capabilities of Large Language Models (LLMs). By decomposing the complex optimization task into specialized sub-tasks managed by a multi-agent pipeline, AMAZe achieves state-of-the-art performance without requiring prior training or domain-specific demonstrations.
The AMAZe Framework
The core of AMAZe is a hierarchical multi-agent pipeline designed to mimic the iterative workflow of a human Database Administrator (DBA). To overcome the context window limitations of LLMs, the system first transforms raw SQL workloads into a compact Workload Representation. Instead of processing thousands of lines of SQL, AMAZe extracts a column-level summary including indexable column names, operator types, estimated cardinality, and a calculated "utility" score. This makes the input size independent of the number of queries.
Multi-Agent Pipeline
The pipeline is divided into high-level and low-level agents that coordinate to find the optimal index set:
- High-Level Agents: The Planning Agent manages the overall strategy and storage constraints, while the Reflection Agent evaluates the current selection path to identify local optima or errors, providing critical feedback loops to the planner.
- Low-Level Agents: The Selection Agent identifies promising single-column candidates. The Combination Agent then merges these into composite indexes based on query patterns and expert rules. Finally, the Revision Agent serves as a safety filter, utilizing a specialized Regression Indicator (a small MLP model) to prune indexes that might inadvertently degrade performance.
Comparative Performance
AMAZe was evaluated against industry benchmarks including TPC-H, TPC-DS, DSB, and JOB. The results demonstrate that AMAZe consistently achieves a superior benefit-to-cost ratio compared to traditional and prompt-based methods. Notably, on the complex Data Services Benchmark (DSB), AMAZe doubled the performance of previous state-of-the-art methods across various budget levels.
The success of AMAZe stems from its ability to handle complexity through decomposition. By assigning specific roles like "Revision" or "Combination" to different agents, the system avoids the pitfalls of single-call LLM failures. Furthermore, its column-centric approach ensures efficiency, outperforming other LLM-based methods that rely on expensive few-shot demonstration searches.
Conclusion
AMAZe demonstrates that LLMs possess significant latent knowledge for database optimization that can be unlocked through structured multi-agent coordination. It provides a zero-shot solution that is both effective and efficient, generalizing across diverse schemas without the need for massive training datasets. Future work will explore reducing API costs through the use of fine-tuned local LLMs and further refining agent instructions to enhance reasoning precision.
Summary updated