Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/Indexing & Storage Engines
STORAGE, CACHING & SEARCH · SUBTOPIC

Composite Indexes, WAL & Bloom Filters

Leftmost prefix rule, covering indexes, and skipping disk reads with Bloom filters.

IntermediatePart of Indexing & Storage Engines
Practice in AI HLD
Subtopics in Indexing & Storage Engines (2)
OverviewB-Trees vs. LSMIndexes & Bloom Filters

In plain words

A phone book sorted by (Last Name, First Name) lets you quickly look up "Smith" or "Smith, Jane" - but NOT "all Janes" without reading every page. That’s the leftmost prefix rule!

Think of it like…

A Bloom filter is a bouncer who knows with 100% certainty who is NOT on the guest list, saving you from walking inside to check.

Loading interactive diagram
Loading interactive exercise

Theory & how it works

The Leftmost Prefix Rule & Covering Indexes

An index on (org_id, created_at) speeds up queries filtering by org_id alone OR (org_id, created_at), but does NOT help a query filtering only on created_at. Always put the highest-selectivity or equality column first.

A covering index (INCLUDE (status)) lets the database answer the entire query directly from the index without touching the main table heap at all.

Key points & practical guide

Summary checklist

  • Composite index (A, B) helps A and (A, B), not B alone
  • Covering indexes avoid extra table heap lookups
  • Bloom filters give zero false negatives, small false positives

When to use it

  • Optimizing slow SQL queries and multi-tenant filters

Watch out for

  • Adding separate indexes on every column - kills insert speed

Quick check

Loading quiz
Previous subtopic
B-Trees vs. LSM-Trees
Back to overview
Full Indexing & Storage Engines Lesson