Sorted Table Block Indexes and Negative Lookups

Use sparse separator keys to find a block in an immutable run and avoid reading data for many absent keys.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. One in-memory index entry can cover many records
  2. A negative lookup can stop at a summary

One in-memory index entry can cover many records

Store sorted keys in blocks. A sparse index records enough of each block’s key boundary to locate the candidate block. With first keys \(10,30,50\), a key \(42\) belongs in the block starting at \(30\) if present, assuming those are the complete block starts. Then search within the block. Compressed representations may use restarts so decoding begins at a nearby known position rather than the start of the file.

A negative lookup can stop at a summary

An applicable Bloom filter can establish that a key is absent from the run, avoiding data access. A possible membership result still needs verification. Several runs can contain versions of the same key, so a run-local absence does not answer the whole lookup. LSM compaction controls which runs need consultation, while external-memory costs capture the block transfer granularity.[1][2]

References

  1. Patrick O’Neil et al., The Log-Structured Merge-Tree ↩
  2. CMU 15-445/645, Introduction to Database Systems: Lectures ↩