Database Index Explorer — Interactive System Design Lab
An index is a second data structure that every insert and update has to keep in sync — that's the write-cost side of the trade. This simulation covers the other side: when the read speed you're paying for never shows up. Index a low-selectivity column (a 50/50 boolean) and the planner correctly ignores it for reads, so every write still pays for an index nobody uses. Then the part interviews actually probe: a composite index on (tenant_id, created_at) serves a filter on tenant_id, and on both columns together, but does nothing for created_at alone — the leftmost-prefix rule. A toggle shows the common mistake it causes: three single-column indexes that individually lose to a sequential scan for the same query a composite index would answer cheaply. Every scenario ends in an EXPLAIN-style readout naming the plan the engine chose and how many rows it examined.
Watch the planner ignore an index — low selectivity, wrong column order — and see why in EXPLAIN.
This free interactive simulation runs directly in your browser — no account needed. Adjust the parameters and watch how the system responds in real time.
Concepts covered
- database index
- B-tree
- index selectivity
- compound index
- query plan
- EXPLAIN
- database performance
Read the guide
- Databases: SQL vs NoSQL — The heart of your architecture. Choosing the wrong database is the most expensive mistake you can make. Learn the 5 families of databases and when to use them.
Related articles
- Top 10 System Design Interview Questions — The most frequently asked system design interview questions — URL shortener, rate limiter, key-value store, news feed, chat, and more — with the approach, key trade-offs, and follow-up questions interviewers actually ask for each one.