Abstract
RadixSpline (RS) is a novel learned index designed for high-performance storage systems like LSM-trees. It combines the lookup efficiency of machine-learning-based models with the rapid, single-pass build speed of traditional data structures. By fitting a linear spline to the data's cumulative distribution function and indexing it with a radix table, RS achieves competitive latency and significant memory savings compared to B-Trees and other state-of-the-art indexes.
Introduction
Traditional index structures, such as B-Trees, serve as the backbone of modern databases but often fail to exploit the underlying distribution of the data they store. Recently, "learned indexes" have emerged, using predictive models to estimate the position of a key within a sorted array. While these models can outperform B-Trees in both size and speed, many state-of-the-art implementations, such as the Recursive Model Index (RMI), require multiple passes over the dataset for training. This slow build process makes them impractical for systems like Log-Structured Merge-trees (LSM-trees), where indexes must be rebuilt rapidly during background merge operations. RadixSpline addresses this gap by providing a learned index that is competitive in performance yet can be constructed in a single pass.
Methods
RadixSpline consists of two simple but powerful components that work in tandem to provide fast lookups with minimal memory overhead:
- The Spline: The system fits a linear spline to the Cumulative Distribution Function (CDF) of the data. Using a "greedy corridor" algorithm, it selects a minimal set of points (knots) such that any linear interpolation between them is guaranteed to stay within a user-defined error bound ($e$).
- The Radix Table: To quickly locate the relevant spline segment for a lookup key, RadixSpline employs a flat radix table. This table uses the first $r$ bits of a key as an offset to narrow down the search range within the spline points.
The primary innovation of RadixSpline is its single-pass construction. As sorted data flows through a system—for instance, during an LSM-tree merge—RadixSpline can identify spline points and populate the radix table simultaneously. This results in constant work per element, allowing build times to scale linearly and predictably with data size.
Evaluation and Key Results
The authors evaluated RadixSpline using the SOSD (Search on Sorted Data) benchmark, which includes diverse real-world and synthetic datasets such as Amazon book popularity (amzn), Facebook user IDs (face), and OpenStreetMap cell IDs (osmc).
Performance Highlights
- Lookup Latency: On the
osmcdataset, RadixSpline achieved lookup latencies between 400-500ns, significantly faster than Binary Search (~850ns) and traditional B-Trees (~600ns), while remaining competitive with the more complex RMI. - Build Speed: RS construction is nearly as fast as B-Trees and significantly faster than multi-pass learned models.
- Memory Efficiency: For most datasets, the index consumed only about 6.6% of the size of the uncompressed keys. In a real-world integration with RocksDB, replacing the default B-Tree index with RadixSpline reduced average read latency by over 20% and used 45% less memory.
Discussion and Future Work
RadixSpline is remarkably simple to tune, relying on only two hyperparameters: the error bound and the number of radix bits. This simplicity, combined with its single-pass nature, makes it an ideal candidate for high-throughput storage engines.
However, the current design is optimized for "write-once/read-many" scenarios and does not yet support individual point inserts into an existing index. Additionally, extreme data skew can reduce the effectiveness of the radix table. Future research directions include developing auto-tuning mechanisms to automatically select optimal parameters based on memory or latency targets, as well as multi-threading the construction process to further enhance performance.
Summary updated