NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Dynamic Index Construction with Deep Reinforcement Learning

Sai Wu, Ying Li, Haoqi Zhu, Junbo Zhao, Gang Chen

Introduction

Database performance is fundamentally tied to the efficiency of its indexing structures. Traditionally, database administrators (DBAs) have relied on a handful of robust but static data structures, such as B-trees or Hash tables. While these structures offer predictable performance, they are often "one-size-fits-all" solutions that fail to exploit the specific characteristics of a given data distribution or workload.

Recent research into "Learned Indexes" has proposed replacing these traditional structures with neural networks that predict the location of data. However, these pure neural approaches often require significant engineering effort, struggle with range queries, and lack the semantic guarantees of traditional indexes. This paper introduces Neural Index Search (NIS), a framework that bridges this gap by using reinforcement learning to automatically assemble high-performance, hybrid indexes from traditional building blocks.

The Neural Index Search (NIS) Framework

The core philosophy of NIS is to treat index construction as an architecture search problem. Instead of replacing the index with a neural network, NIS uses a neural network—specifically a stacked Recurrent Neural Network (RNN)—as a "controller" to design the index.

The NIS framework uses an RL loop where a controller proposes an index architecture, which is then evaluated to provide a reward signal.

As shown in the architecture above, the process follows a reinforcement learning loop. The controller samples an index architecture with a specific probability. The Index Builder then materializes this architecture into a physical index using data from the database. The system executes a representative workload and measures performance metrics like latency and space utilization. These metrics are combined into a reward signal, which is used to update the controller via Proximal Policy Optimization (PPO), guiding it toward more efficient designs in subsequent iterations.

Modular Building Blocks

NIS decomposes complex index structures into two fundamental primitives:

  1. Ordered Blocks: These maintain sorted keys (similar to B+-tree nodes) and are ideal for range scans.
  2. Unordered Blocks: These use partitioned keys (similar to Hash buckets) to provide fast O(1) lookups for point queries.
NIS assembles indexes by combining ordered and unordered blocks into a hierarchical structure tailored to the data.

By combining these blocks, NIS can discover hybrid structures that outperform pure implementations. For instance, it might generate an index that uses ordered blocks at the top levels for efficient range filtering and switches to unordered blocks at the leaf level for rapid data retrieval. To maintain scalability across millions of keys, NIS employs a "grouping" strategy where parameters are predicted for groups of blocks sharing consecutive key ranges rather than individual nodes.

Performance and Key Insights

The framework was evaluated against a variety of synthetic and real-world datasets, including OpenStreetMap (osmc) and Amazon product metadata.

  • Adaptability: On the complex osmc dataset, NIS outperformed traditional B-trees and state-of-the-art learned indexes like PGM. It proved particularly robust on non-linear, "chaotic" data distributions where mathematical function-fitting often fails.
  • Efficiency: NIS achieved superior performance with significantly lower memory overhead. For example, on osmc, it required only 21MB of storage compared to 40MB for Google’s Recursive Model Index (RMI).
  • Practicality: The RL controller typically converges to an optimal structure in fewer than five epochs. Furthermore, by including a Tree-LSTM to monitor performance in real-time, NIS can detect data distribution shifts and trigger local re-tuning, ensuring the index remains optimal as the database grows.

Conclusion

Neural Index Search demonstrates that the most effective way to apply machine learning to database indexing is not necessarily to replace traditional structures, but to automate their composition. By leveraging the strengths of both ordered and unordered primitives through a reinforcement learning framework, NIS provides a path toward truly autonomous, self-tuning database systems that offer both high performance and the reliability of classical data structures.

Summary updated

BibTeX
@article{wu2022dynamic,
  author = {Sai Wu and Ying Li and Haoqi Zhu and Junbo Zhao and Gang Chen},
  title = {{Dynamic Index Construction with Deep Reinforcement Learning}},
  journal = {Data Sci. Eng.},
  year = {2022},
  doi = {10.1007/s41019-022-00186-4},
}
Figure