Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Learned Index Comparative Landscape & SOTA Analysis

Learned index structures replace or augment pointer-based hierarchical search trees by framing indexing as a cumulative distribution function (CDF) regression problem. Since the seminal proposal by Kraska et al. (2018), multiple distinct architectures have emerged, each navigating different microarchitectural trade-offs between theoretical guarantees, build speed, update mutability, and hardware cache alignment.

This document provides a comparative analysis of the primary learned and classical index designs.


1. High-Level Taxonomy Matrix

ArchitectureSeminal PublicationModel RepresentationLookup ComplexitySpace Bound GuaranteeIn-Place Write Support
Classical B+Tree / BTreeMapBayer & McCreight (1972); Comer (1979)Multi-way pointer/node hierarchyO(log_B N)Worst-case 50% storage utilizationFully dynamic (O(log_B N) rebalancing)
RMI (Recursive Model Index)Kraska et al. (SIGMOD 2018)Multi-stage staged regressions (Linear / Neural / Splines)Variable / Empirical boundsHeuristic (no formal worst-case bound)Read-only (full retrain needed)
FITing-TreeGalakatos et al. (SIGMOD 2019)Piecewise linear segments indexed by classical B+TreeO(log S + log ε)Heuristic PLA boundDynamic via buffer / leaf shifts
PGM-IndexFerragina & Vinciguerra (PVLDB 2020)Optimal streaming PLA indexed recursivelyO(h · log ε) or O(log S + log ε)Provably optimal segment count for fixed εRead-heavy / Batch merge (O(N + M))
RadixSplineKipf et al. (aiDM 2020)Top radix lookup table + linear spline pointsO(1 + log ε)Bounded by spline points + 2^r radix tableRead-only (single-pass build)
ALEXDing et al. (SIGMOD 2020)Adaptive gapped array nodes + linear modelsO(log N) expectedHeuristic (subject to gap fragmentation)Fully dynamic (in-node shifts & splits)

2. Structural & Microarchitectural Profiles

Classical B+Tree (std::collections::BTreeMap)

  • Core Philosophy: Partition keys into fixed-size node pages connected by pointers. Rust’s standard library implementation packs up to 11 keys and 12 children per internal node to optimize L1/L2 cache-line filling.
  • Hardware Profile: Sequential node traversal across heap pages induces repeated pointer dereferences and cache misses when the tree exceeds the CPU cache hierarchy.
  • Key Advantage: Distribution-agnostic robustness. Delivers predictable $O(\log N)$ performance regardless of non-linear plateaus, extreme Pareto skew, or adversarial patterns. Unmatched support for concurrent writes via page-level latch crabbing.
  • Primary Bottleneck: Index metadata footprint ($15%\text{–}30%$ of total storage) and lack of arithmetic rank interpolation.

RMI (Recursive Model Index)

  • Core Philosophy: A directed acyclic graph of models organized in layers (typically 2 to 3 stages). The root model maps an input key to a child model in layer 1, which progressively narrows the prediction corridor until the leaf model estimates the exact array offset.
  • Hardware Profile: Very fast arithmetic execution when models fit in CPU registers and L1 cache. Often executes in sub-10ns when simple linear or polynomial models are used.
  • Key Advantage: Ultra-low lookup latency on smooth, continuous, and predictable distributions (e.g. uniform or Gaussian).
  • Primary Bottleneck: Non-deterministic worst-case bounds. If an irregular key cluster diverges from the regression, the local search window can expand significantly, degrading to linear scan or wide binary search. High training overhead and lack of in-place mutation.

RadixSpline

  • Core Philosophy: Fits a greedy linear spline with error bound $\varepsilon$ during a single sequential scan, and layers a direct radix lookup table indexing the top $r$ bits of spline segment keys.
  • Hardware Profile: The top radix lookup operates in $O(1)$ with a single array indexation, eliminating binary search over spline anchors. The remaining window is verified with binary search within the bounded corridor $[-\varepsilon, +\varepsilon]$.
  • Key Advantage: Extremely fast single-pass build time with integer-only radix indexing. Predictable flat memory layout.
  • Primary Bottleneck: Radix sensitivity. Highly skewed keys sharing identical leading bit patterns degrade the radix table’s selectivity, forcing larger spline intervals or excessive radix table memory allocation ($2^r \times \text{pointer size}$).

ALEX (Adaptive Learned Index)

  • Core Philosophy: Blends learned linear models with gapped arrays inside dynamic tree nodes. Models predict target slots within gapped memory buffers, absorbing incoming insertions without immediate structural shifts.
  • Hardware Profile: High cache locality for in-memory read-write workloads. When gaps fill, nodes split or expand dynamically.
  • Key Advantage: Efficient dynamic insertions and updates within an in-memory learned architecture, outperforming B+Trees on mixed read/write workloads under gentle distributions.
  • Primary Bottleneck: Memory fragmentation caused by vacant gap slots. Degrades under non-uniform insertion bursts, triggering costly node expansions and structural rebalancing.

PGM-Index (learned-index)

  • Core Philosophy: Uses optimal streaming piecewise linear approximation (PLA) to compute the minimal number of segments $S$ covering $N$ keys within a deterministic vertical error corridor $\pm \varepsilon$. The resulting segment anchors can themselves be indexed recursively.
  • Hardware Profile: Each segment is represented by a compact 24-byte struct (key: u64, slope: f32, intercept: f32). Local search executes within a tiny bounded slice ($2\varepsilon + 1$ keys), fully residing in L1 cache (e.g. 65 elements for $\varepsilon=32$).
  • Key Advantage: Provable worst-case guarantees for both lookup time ($O(\log S + \log \varepsilon)$) and segment count optimality (Ferragina & Vinciguerra, 2020). Extreme index compression (metadata down to $0.003\text{ MB}$ per million keys vs $45.8\text{ MB}$ for BTreeMap).
  • Primary Bottleneck: Immutable base data array. Dynamic writes require out-of-place LSM-tree buffering or two-way batch merges ($O(N + M)$). Slower than classical trees on extreme Pareto heavy tails (e.g. SOSD Books) where non-linear steps explode segment counts.

3. Detailed Trade-off Matrix

Metric / DimensionB+Tree / BTreeMapRMIALEXRadixSplinePGM-Index
Deterministic Error ± εExact page boundariesNo (heuristic fallback)No (gapped offsets)Yes (± ε)Yes (± ε provable)
Segment Count OptimalityN/AHeuristicHeuristicGreedy heuristicProvably optimal
Build Time ComplexityO(N log N)O(N · epochs)O(N log N)O(N) single passO(N) single pass
Build Throughput2–5 M keys/s0.2–1 M keys/s1–4 M keys/s> 20 M keys/s10–15 M keys/s
Index Metadata OverheadHigh (15%–30%)Low (< 1%)Moderate (10%–25%)Very Low (< 1%)Minimal (< 0.1% to 0.01%)
In-Place InsertionsNative (O(log N))Not supportedNative (O(log N))Not supportedLSM / Batch Rebuild (O(N + M))
Concurrent WritesHigh (fine-grained latches)NoneComplex node locksNoneReader-Writer lock on snapshot
Extreme Skew ResilienceOptimalPoorModeratePoorModerate to Poor
Hardware FitMemory latency boundALU boundCache & pointer boundMemory latency boundL1 cache bound (local scan)

4. Workload Decision Guide

Select the indexing structure tailored to workload constraints:

  1. High-Frequency In-Place Updates & Transactions (OLTP):

    • Recommendation: Classical B+Tree / BTreeMap.
    • Reasoning: Unmatched page-level locking, predictable tree balance, and zero overhead for out-of-order writes.
  2. In-Memory Mixed Read/Write with Regular Key Distributions:

    • Recommendation: ALEX.
    • Reasoning: Combines learned prediction with gapped array insertion buffers, delivering high write throughput without periodic full rebuilds.
  3. Ultra-Fast Ingestion / Ephemeral Columnar Row Groups:

    • Recommendation: RadixSpline.
    • Reasoning: Constructing the index requires only a single sequential pass with direct radix table population, ideal for short-lived immutable batches.
  4. Immutable SSTables, Parquet Footers, NVMe/DRAM Constrained Systems:

    • Recommendation: PGM-Index (learned-index).
    • Reasoning: Minimal metadata footprint ($14,700\times$ smaller than B-Trees) and strict deterministic worst-case bounds make it suited for read-heavy immutable storage layers.
  5. Heavy-Tailed, Non-Linear Key Distributions (e.g. Pareto, Power-Law Books):

    • Recommendation: Classical B+Tree / EytzingerSearch.
    • Reasoning: Empirical benchmarks demonstrate that classical structures outperform linear learned models by $2.8\times$ when severe key clustering causes segment count explosion.

Academic References

  • Kraska, T., Beutel, A., Chi, E. H., Dean, J., & Polyzotis, N. (2018): “The Case for Learned Index Structures”, ACM SIGMOD, pp. 489–504.
  • Ferragina, P., & Vinciguerra, G. (2020): “The PGM-index: a fully-dynamic compressed learned index with provable worst-case bounds”, PVLDB 13(8): 1162–1175.
  • Ding, J., Min, D., Yu, H., & Kraska, T. (2020): “ALEX: An Updatable Adaptive Learned Index”, ACM SIGMOD, pp. 969–984.
  • Kipf, A., Marcus, R., van Renen, A., Stoian, M., Kemper, A., Kraska, T., & Neumann, T. (2020): “RadixSpline: a single-pass learned index”, aiDM@SIGMOD, pp. 5:1–5:8.
  • Galakatos, A., Markovitch, M., Binnig, C., Fonseca, R., & Kraska, T. (2019): “FITing-Tree: A Data-aware Index Structure”, ACM SIGMOD, pp. 1189–1206.
  • Bayer, R., & McCreight, E. (1972): “Organization and Maintenance of Large Ordered Indices”, Acta Informatica 1(3): 173–189.