Apex › Storage & databases

Roaring bitmaps — the compressed index

How databases store a set of millions of integer IDs compactly and intersect two of them at memory speed. The key space is split into chunks of 65536, and each chunk picks its own container — a sorted array when sparse, a flat 8 KB bitmap when dense. Add sparse and dense keys and watch the containers adapt, with a memory comparison to the naive options.

More in Storage & databases