DILI: A Distribution-Driven Learned Index

Pengfei Li, Hua Lu, Rong Zhu, Bolin Ding, Long Yang, Gang Pan

Abstract

Traditional indexing structures like B+Trees often fail to exploit the underlying distribution of data, leading to suboptimal performance in modern in-memory environments. While "learned indexes" have emerged to address this by treating indexing as a regression problem, existing solutions often struggle with dynamic updates, rigid structural constraints, or excessive memory consumption. This paper introduces DILI (DIstribution-driven Learned Index), a novel in-memory index tree that utilizes linear regression models to navigate data based on its actual distribution. By implementing a unique two-phase construction process—combining bottom-up layout optimization with top-down model assignment—DILI achieves significant improvements in search speed and cache efficiency. Evaluation against state-of-the-art indexes like ALEX and LIPP demonstrates that DILI provides a high-performance, memory-efficient, and fully updatable indexing solution.

1. Introduction

For decades, B+Trees have served as the standard for database indexing. However, as "data-blind" structures, they do not account for the specific patterns or densities within a dataset. The advent of learned indexes, such as the Recursive Model Index (RMI), proposed replacing traditional tree nodes with machine learning models to predict key locations. Despite their potential, early learned indexes were often static or relied on rigid fanout structures (e.g., ALEX) that could not adapt to complex distributions, such as long-tail data. Others, like LIPP, achieved high accuracy but at the cost of significant memory overhead. DILI addresses these gaps by providing a distribution-aware architecture that remains memory-efficient and supports dynamic insertions and deletions.

2. Design and Methodology

DILI’s architecture consists of a hierarchy of nodes, where each node contains a concise linear regression model. The system’s efficiency stems from its specialized node design and a sophisticated two-phase construction strategy.

2.1 Internal Node Design

Unlike B+Trees, which store specific keys to guide search paths, DILI’s internal nodes divide their key range equally among their children. This design choice transforms a traditional search—which requires scanning or binary searching through keys—into a simple mathematical calculation. By using a linear function to determine the correct child node, DILI eliminates local searches within internal nodes and significantly reduces cache misses, which are the primary bottleneck in modern CPU performance.

2.2 Two-Phase Bulk Loading

DILI is constructed using a unique two-phase approach to ensure the tree structure is perfectly tailored to the data distribution:

  1. Bottom-Up (BU-Tree) Phase: The system first builds a temporary bottom-up tree. It employs a greedy merging algorithm to determine the optimal fanout (number of children) for each node. This decision is guided by a cache-aware cost model that balances local data density against the time cost of potential cache misses.
  2. Top-Down (DILI) Phase: The final DILI tree is then constructed top-down. This phase mirrors the layout determined by the BU-Tree but adjusts the linear models to maintain the "equal division" property required for fast internal navigation.

2.3 Leaf Node and Local Optimization

At the leaf level, DILI employs "local optimization" to eliminate the "last-mile" search. Data records are placed at the exact positions predicted by the model. In instances where multiple keys map to the same position (collisions), DILI creates small sub-nodes to manage the overflow, ensuring that the primary search path remains extremely shallow.

3. Experimental Evaluation

The authors evaluated DILI using the SOSD (Search on Sorted Data) benchmark, utilizing four massive real-world datasets and one synthetic dataset:

  • FB: 200 million Facebook user IDs.
  • WikiTS: 200 million Wikipedia request timestamps.
  • OSM: 800 million OpenStreetMap cell IDs.
  • Books: 800 million Amazon book IDs.
  • Logn: A synthetic dataset of 200 million values following a heavy-tailed log-normal distribution.

4. Results and Discussion

4.1 Search Performance and Cache Efficiency

DILI demonstrated superior lookup speeds across all tested datasets. It was recorded to be 9% to 34% faster than LIPP, the previous state-of-the-art learned index. This performance gain is largely attributed to its individualized fanouts and calculation-based navigation. By allowing the tree to be "shallow" in simple data regions and "deep" only where data is complex, DILI optimizes the traversal path. Furthermore, DILI triggered up to 9.7 fewer Last-Level Cache (LLC) misses per query compared to ALEX, validating the effectiveness of its cache-aware cost model.

4.2 Update Throughput and Memory Usage

In write-heavy workloads (comprising 100 million insertions and 50 million queries), DILI maintained the highest throughput among its competitors. This proves that its learned structure is resilient to data shifts and does not degrade significantly under the pressure of new insertions. Regarding memory, while DILI requires more space than a standard B+Tree to accommodate its local optimization slots, it uses an order of magnitude less memory than LIPP, making it a more viable candidate for large-scale, memory-constrained deployments.

5. Conclusion and Future Work

DILI represents a significant advancement in learned indexing by successfully balancing distribution-awareness with operational efficiency. By turning searches into calculations and utilizing a two-phase construction process, it achieves industry-leading performance on in-memory datasets.

Future research directions include adapting DILI for disk-resident data, which would require a shift from cache-aware cost models to I/O-focused models. Additionally, the authors suggest extending the framework to support multidimensional keys and implementing high-performance concurrency control to further enhance its utility in multi-threaded database environments.

Summary updated

BibTeX
@article{li2023dili,
  author = {Pengfei Li and Hua Lu and Rong Zhu and Bolin Ding and Long Yang and Gang Pan},
  title = {{DILI: A Distribution-Driven Learned Index}},
  journal = {Proc. VLDB Endow.},
  year = {2023},
  doi = {10.14778/3598581.3598593},
}
Figure