Apex › Storage & databases

How a hash index grows (extendible hashing)

The other kind of database index: a hash index that grows without ever rehashing everything. A directory of pointers, indexed by the low bits of a key’s hash, points to fixed-size buckets — and several slots can share a bucket. When a bucket overflows it splits (one page), and only if needed does the directory double, which just copies pointers, never the keys. Verified in node over 300 insert sequences: lookups match a reference set, no bucket overflows, the directory is always 2^globalDepth, and every local depth ≤ global. Step through inserts and watch it split and double.

More in Storage & databases