Every database you have ever used hides a B-tree beneath the surface. A B-tree is a balanced tree of sorted nodes; to find a key you walk from the root through a chain of comparisons until you reach the right page. It is elegant, general, and optimal in a worst-case sense — roughly comparisons per lookup.
But "general" hides a cost. A B-tree knows nothing about the data it indexes. It treats user IDs that arrive almost sequentially the same as random cryptographic hashes. It cannot exploit the fact that timestamps cluster by day, or that URLs follow a predictable lexicographic pattern.
In 2018 Tim Kraska and colleagues asked a deceptively simple question: what if the index were a model trained on the actual data? If the keys follow any learnable pattern, a model can predict the approximate position of a key in a sorted array in a single forward pass — then a tiny linear scan finishes the job. The result: smaller memory footprint, fewer cache misses, and lookups that can beat a B-tree by an order of magnitude on real-world workloads.
The idea reframes an index as a learned approximation of the cumulative distribution function (CDF) of the keys. If you know roughly where rank keys live, you know roughly where any new key lands.
Comments
Loading comments...