Learned Index Structures
Use a rank model to narrow exact searches and compare the error guarantees and physical access costs of RMI and PGM-index designs.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 3
- Reading time
- 2 min
In this article3 chapters
The model approximates a rank
In a sorted array, define \(r(x)=|\{i:a_i<x\}|\), the lower-bound position of a key \(x\). This definition handles duplicates by returning the first possible position and absent keys by returning an insertion point. If a predictor \(\widehat r(x)\) has a certified integer error bound \(\varepsilon\) at that probe, the true position lies in
\[ [\widehat r(x)-\varepsilon,\ \widehat r(x)+\varepsilon]\cap[0,n]. \]
An exact lower-bound search restricted to that range takes \(O(\log(2\varepsilon+1))\) comparisons for \(\varepsilon\ge1\). The lookup returns the checked position, with \(n\) allowed as the past-the-end value. If a guarantee is established only for stored distinct keys, absent probes and duplicates require separately justified bracketing rules.
A sorted boundary search explains how to check a predicted rank exactly once the remaining interval is known. B-tree page layout gives a comparison point for memory movement in conventional ordered indexes.
A hierarchy trades model cost for local search
A recursive model index routes a query through a small hierarchy whose final model specializes in a portion of the key space. Per-model error bounds or a correct fallback search preserve exact answers. The PGM-index models position using piecewise linear segments with a prescribed maximum error. At the next level it can approximate where to find the appropriate segment. Choosing a tighter error budget increases the number of segments on many datasets and may move more of the lookup state out of cache.
Layout and update costs are part of the comparison
The relevant cost includes prediction, residual access, scans of nearby records and amortized maintenance. For a read-heavy sorted table, a small model plus a compact local search may reduce cache misses. Insert-heavy tables need a way to buffer writes or update the layout without rebuilding a global index repeatedly. Cost-based optimization decides when such access is preferable. Approximate neighbor search can trade recall for speed, whereas a learned ordered index can preserve exact lookup through its final check.[1][2]