System Design Database Choice Interview

System Design Database Choice Interview

System design database choice interviews separate “we’ll use Postgres and Redis” from a design that starts with access patterns, consistency, and scale shape. This guide is a practical chooser: how to pick (and defend) a primary store in a design interview.

Start with access patterns, not logos

Talk track:

“Before picking a database, I want the read/write ratio, query shapes, consistency needs, and whether we need multi-row transactions.”

If you cannot describe the hottest queries, you are guessing. Product names without query shapes read as memorized architecture astronautics.

Clarifying questions that matter

  1. Entities and relationships (1:1, 1:N, graph-like?)
  2. Transactions across multiple rows/tables?
  3. Query patterns: point lookup, range, full-text, analytics?
  4. Consistency: strong for money/inventory vs eventual for feeds?
  5. Scale: working set size, QPS, growth
  6. Geo: single region vs multi-region active-active?

Write these on the board before you say “Postgres.”

SQL vs document vs KV (interview defaults)

Store typeStrong fitWeak fit
Relational (Postgres/MySQL)Joins, constraints, multi-row ACID, mature opsUltra-wide flexible docs at massive write scale (sometimes)
DocumentFlexible nested records, per-document accessHeavy cross-document joins, complex multi-doc transactions
Wide-columnTime-series-ish, large sparse rowsAd-hoc relational queries
KV / cacheSessions, hot keys, simple getsRich querying
Search engineFull-text, relevanceSystem of record
Graph DBDeep relationship traversalSimple CRUD with rare hops

Default for most product APIs: relational primary unless the prompt screams otherwise. That is not conservatism—it is matching common interview expectations and real constraints.

Consistency scripts

NeedApproach
Payments, inventory, seatsStrong consistency + transactions
Social feed fan-outOften eventual; say the lag
User profile read-your-writesPrimary read or session stickiness
AnalyticsWarehouse / OLAP separate from OLTP

Never claim “NoSQL cannot do transactions” or “SQL cannot scale”—both are cartoon versions. Speak in mechanisms: sharding, replicas, isolation levels, quorum writes.

Index and query talk track

Talk track:

“Orders are relational with transactional stock decrement; the product catalog search goes to a search index updated asynchronously.”

Modeling pitfalls to name early

Polyglot is a privilege you earn

Multiple databases are fine after you justify each:

  1. OLTP relational for truth
  2. Cache for hot reads
  3. Queue for async
  4. Search / warehouse as derivatives

Drawing five stores in minute two without access patterns looks like memorization. Earn the second store with a bottleneck sentence.

Sharding and replication (only when needed)

Mention when QPS or data size forces it:

Talk track:

“At this QPS a single primary with replicas is enough; I’d shard by tenantId only if a single tenant can dominate or data exceeds comfortable single-node size.”

First five minutes

  1. List entities + critical transactions
  2. Name hottest queries
  3. Pick primary store with one sentence why
  4. Add cache/search only if the bottleneck needs it
  5. Call out consistency for the money path

Mini decision tree (say it in sixty seconds)

  1. Need multi-row ACID for money/inventory? → relational primary
  2. Mostly document fetch by id with flexible fields? → document OK
  3. Hot key / session / rate counters? → KV/cache beside primary—not instead
  4. Full-text relevance? → search derivative
  5. Deep multi-hop graph as the product? → consider graph; otherwise relational + careful modeling

Talk track:

“Primary is Postgres for orders and stock; Redis for session and hot product pages; OpenSearch for catalog query—each has one job.”

Freeze recovery

  1. Erase brand soup
  2. Write: entities → queries → primary DB
  3. Circle the one transaction that must be ACID
  4. Add the second store only with a named job (cache/search/analytics)

Soft practice note

Database choice is a communication skill under ambiguity. If you want a Chrome side panel to practice this system design database choice talk track under timed pressure, Luna Interview is built for calm rehearsal. Use it to structure your reasoning—not to invent fake war stories or to violate interview rules.

Day-of checklist

Pick the store that fits the queries—then defend it cleanly.