Try
↑ ↓ move↵ openesc close
In this lesson · topic 5 of 7
  1. 1. Finding one row without reading them all
  2. 2. Secondary indexes and Bloom filters
  3. 3. Tune a filter and add indexes
  4. 4. Each index is a tax on every write
  5. 5. Bits per key against false positives
  6. 6. Where filters help and where they do not
  7. 7. False positives, hashes and index cost

Topic 5

Bits per key against false positives

5 min read

The curve

The lab measured the false positive rate at several sizes, each with the best number of hashes for its size.

Bits per key False positives
4 15%measured
6 5.3%measured
8 1.9%measured
10 0.9%measured
14 0.08%measured

Each extra bit multiplies the rate by about the same factor below one. So early bits buy a lot, and late bits buy little in absolute terms. Going from 4 bits to 10 removes most of the wrong answers. Going from 10 to 14 turns a rare event into a very rare one, for 40 percent more memory.

The number of hashes

With 10 bits per key and one hash, the rate is 9%measured. One check is weak evidence, because it only tests one bit. With twelve hashes it is 1.4%measured. Each key sets so many bits that 70%measured of the array is set, and strangers hit set bits often. The best count for 10 bits is 7measured.

What a false positive costs

A false positive on an LSM read costs one file lookup that finds nothing. Consider a miss with tiered compaction. Without filters it checks 6measured files. With a 10-bit filter on each, the expected number of wasted checks is about 0.05measured. The filter turns a miss from several reads into almost none.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms