Every database query eventually reaches an index â a structure that lets the engine skip straight to the right rows instead of scanning millions of them. For decades, the workhorse index has been the B-tree: a balanced tree whose branching factor is tuned to fill a disk block, keeping the tree shallow and lookups fast.
But in-memory databases and flash storage changed the game. The bottleneck shifted from disk access to CPU cache contention and thread synchronization. A classic B-tree protects each node with a latch (a short-lived lock): while one thread writes a node, every other thread that needs it waits. On a chip with 48 cores, that queue becomes the new slow path.
In 2013, researchers at Microsoft Research â Justin Levandoski, David Lomet, and Sudipta Sengupta â published a structure that eliminates latches almost entirely: the Bw-Tree (Buzzword-Tree). Instead of updating a node in place, it appends a small delta record in front of it and then swaps a single pointer with a CPU atomic instruction. Readers see either the old state or the new one; they never catch a half-written node. The result is an index that scales nearly linearly with thread count, now powering SQL Server Hekaton and other production systems.
Comments
Loading comments...