Abstract: There is great excitement about learned index structures, but understandable skepticism about the practicality of a new method uprooting decades of research on B-Trees. In this paper, we work to remove some of that uncertainty by demonstrating how a learned index can be integrated in a distributed, disk-based database system: Google's Bigtable. We detail several design decisions we made to integrate learned indexes in Bigtable. Our results show that integrating learned index significantly improves the end-to-end read latency and throughput for Bigtable.
Introduction
Since their introduction in 2018, learned index structures have generated immense excitement and equal amounts of skepticism. The original premise was that a machine learning model—such as a neural network or linear regression—could learn the distribution of keys in a dataset to predict their location more efficiently than a traditional B-Tree.
However, critics argued that these gains were "nanosecond improvements" only applicable to in-memory datasets. In the real world of "Google-scale" databases like Bigtable, data lives on disk, and requests take milliseconds. Skeptics doubted that a slightly faster lookup would matter when the bottleneck is slow disk I/O. Furthermore, early learned indexes struggled with data inserts and weren't designed for the block-based storage architecture used by most production databases. This research tackles these doubts head-on by integrating learned indexes into a production-grade, distributed, disk-based system.
Methodology
To integrate learned indexes into Bigtable, the researchers moved away from predicting a record's exact position and instead adapted the model to work with Bigtable’s SSTable (Sorted String Table) format.
- Predicting Bytes, Not Positions: Instead of training a model to find a specific row, they train it to predict how many bytes into the file a record likely falls.
- Defining Block Boundaries: By using the model to define where data blocks start and end during the file creation process, the model is "always correct" by construction. This eliminates the need for expensive local searches if a prediction is slightly off.
- Handling String Keys: To make string keys compatible with linear regression, the authors developed a character-by-character re-basing technique, converting strings into high-precision numerical representations based on the ASCII range for each character position.
- Model Selection: Simple linear regression was chosen to provide the best balance of low storage overhead and fast inference times compared to more complex Recursive Model Indexes (RMIs).
Evaluation
The evaluation was performed using synthetic datasets designed to simulate Bigtable workloads, featuring tables ranging from 16 million to 512 million rows. The environment consisted of 5 tablet servers with 4GB RAM each, serving requests to 15 concurrent clients using random integer keys (encoded as strings) with 1KB row sizes and 32KB data blocks.
Key Results and Insights
The integration of learned indexes into Bigtable yielded substantial performance gains over the default two-level B-Tree index. The most surprising finding is that the speed of the model itself is less critical than the index compression it enables. Because the learned model is orders of magnitude smaller than a B-Tree index, it is much more likely to stay in the cache (RAM).
As shown in the figure above, the performance improvements were consistent across all primary metrics:
- Latency: Mean read latency dropped by 36% for point lookups and 22% for scans. Notably, the p99 latency (the slowest 1% of requests) for point lookups improved by 38%.
- Throughput: The system handled 55% more point lookups and 28% more scans per second.
- Resource Efficiency: By reducing the number of blocks accessed and decompressed, the learned index also reduced overall CPU consumption.
In traditional systems, if the index isn't in RAM, the system must perform 1–2 extra disk reads just to find the data. The learned index is so small that it eliminates these extra "index seeks," which is why the p99 (tail) latency improves so dramatically.
Limitations and Future Work
While the results prove that learned indexes are a viable optimization for large-scale distributed databases, several areas remain for further exploration:
- Complex Key Distributions: Preliminary results used relatively uniform data; real-world key distributions may require more sophisticated models.
- Write Performance: While training happens in the background, the overhead of re-training models during frequent data compactions in write-heavy environments needs longitudinal study.
- Mapping Table Compression: Further compression of mapping tables for block pointers could yield even greater efficiency gains.
In conclusion, this work demonstrates that learned indexes can significantly boost the performance of massive, disk-based systems by shrinking index sizes and reducing expensive disk I/O.
Summary updated