Presented at AIDB 2021, PLEX (Practical Learned Index) is a system designed to bridge the gap between theoretical learned index research and production-ready database tools. It simplifies learned indexing by reducing complex configuration down to a single hyperparameter: the maximum allowable prediction error ($\epsilon$).
The Practicality Gap in Learned Indexing
Learned indexes aim to replace traditional structures like B-Trees by "learning" the distribution of data keys to predict their location. However, existing models often suffer from three "practicality" hurdles:
- Hyperparameter Complexity: Models like RMI (Recursive Model Index) require tuning numerous parameters, often necessitating expensive offline grid searches.
- Lack of Guarantees: Many models do not provide a hard bound on prediction error.
- Outlier Sensitivity: Earlier models like RadixSpline (RS) perform poorly when data is skewed or contains "outliers" (keys with long common prefixes), as their simple radix tables cannot effectively partition the search space.
Methodology: Splines and Auto-Tuned Radix Trees
PLEX is a hybrid architecture that builds upon two existing concepts: RadixSpline (RS) and Compact Hist-Trees (CHT).
- The Spline Layer: PLEX first builds a linear spline that approximates the Cumulative Distribution Function (CDF) of the data. This ensures that any key's position is predicted within a user-defined maximum error ($\epsilon$).
- The Radix Layer (CHT): Instead of the flat radix table used in RS, PLEX uses a multi-level radix tree (CHT). This allows the index to adaptively "deepen" its search in areas where keys are densely packed or share many prefix bits.
- Auto-Tuning via LCP Histograms: The core innovation is an algorithm that automatically determines the best configuration for the CHT. It uses a Longest Common Prefix (LCP) histogram to simulate various tree depths and fan-outs. By applying a mathematical cost model to this histogram, PLEX can predict the average lookup time and memory consumption of thousands of possible configurations without actually building them.
Experimental Evaluation
The authors evaluated PLEX using the SOSD (Search on Sorted Data) benchmark, featuring four datasets of 200 million 64-bit keys: amzn (book popularity), face (Facebook user IDs), osm (Open Street Map cell IDs), and wiki (Wikipedia timestamps).
Key Results
- Robustness: On the
facedataset, where RadixSpline's performance typically craters due to outliers, PLEX successfully detects the problem via its cost model and switches to a multi-level CHT, maintaining high performance. - Build Speed: PLEX retains the high build performance of RadixSpline. Even with the added auto-tuning step, it is significantly faster to build than RMI, which requires extensive training.
- Lookup Latency: PLEX consistently offers a competitive trade-off. On
amznandface, it maintains a constant offset of roughly 25ns compared to the highly-optimized RMI, but with much simpler configuration.
Conclusion and Future Work
By making $\epsilon$ the only hyperparameter, PLEX makes learned indexes "practical," allowing developers to easily trade memory for lookup speed. While currently optimized for read-only workloads, the authors plan to extend PLEX to support efficient writes and updates by incorporating Fenwick trees into the tree nodes, enabling the index to handle dynamic datasets more effectively.
Summary updated