Course contentsShow
← System Design
Lesson 429 of 1,91912. NoSQL: Wide-Column StoresFree lesson

Read Path and Bloom Filters

How reads check memtable, use bloom filters, and merge results from multiple SSTables.

Read Path and Bloom Filters

What you'll learn: How wide-column stores like Cassandra efficiently locate data during reads by checking multiple storage layers and using bloom filters to avoid unnecessary disk seeks.


The Read Journey

When you query data in a wide-column store, the system doesn't know exactly where your data lives—it might be in memory or spread across multiple immutable SSTable files on disk. The read path follows a specific sequence:

  1. Check the memtable first (in-memory write buffer) — fastest lookup
  2. Consult bloom filters for each SSTable — probabilistic check to skip entire files
  3. Read matching SSTables — scan files that likely contain your data
  4. Merge results — combine data from multiple sources, keeping the most recent version

What Are Bloom Filters?

A bloom filter is a space-efficient probabilistic data structure that answers one question: "Is this key definitely not in this SSTable?"

Think of it like a restaurant host checking a reservation list. Instead of reading the full book, they use a quick index card system. If the card says "no," you're definitely not on the list. If it says "maybe," they'll check the full book.

Bloom filters can have false positives (says "maybe" when data isn't there) but never false negatives (if it says "no," the data is truly absent). This prevents wasting time reading SSTables that don't contain your data.

Why This Matters

Without bloom filters, you'd need to check every SSTable on disk—potentially dozens of files. With bloom filters, you skip most files immediately, reading only 1-3 SSTables in practice. This transforms reads from scanning everything to targeted lookups.

Key Takeaway: The read path checks the memtable first, uses bloom filters to eliminate SSTables that don't contain the requested key, then merges results from the remaining SSTables—making reads efficient despite data being scattered across immutable files.