System Design · Architecture under constraints

How do you choose between SQL and NoSQL in a system design?

Mediumsqlnosqlaccess patternsUpdated Oct 2026
Quiz this track

Short answer

Start from access patterns, consistency needs and scale. Relational databases excel at joins, constraints and transactions; NoSQL stores trade those for partition tolerance, flexible schemas and horizontal scale.

The database choice follows the data model and query pattern, not fashion. A relational database gives a mature query planner, joins, constraints, transactions and secondary indexes. A NoSQL store often gives simpler horizontal partitioning and a schema shaped around one access path, at the cost of ad hoc queries and cross-entity transactions.

Common NoSQL families

  • Key-value: simple lookups by key, very fast, with limited query flexibility
  • Document: nested objects and per-document reads, good for aggregates with varied shape
  • Wide-column: high write throughput and range scans within a partition key
  • Graph: traversals across highly connected data, less suitable for bulk aggregation
  • Search engine: inverted indexes for text and faceted queries, usually a secondary store

Ask what the consistency requirement is. If the operation needs a multi-row invariant, such as transferring funds or claiming a unique username, a transactional store is simpler and safer. If the data is append-only events or a per-user document, a partitioned store can scale more naturally. If the dominant query is full-text search, an inverted index is the right tool even when the source of truth is relational.

It is normal to use more than one store. Keep a relational source of truth for money, a cache for hot reads, an object store for blobs and a search index for text. The hard part becomes keeping them in sync, which usually means an outbox or change data capture plus idempotent consumers.

A NoSQL store does not automatically scale. Poor partition keys, hot rows and cross-partition queries cause the same problems as a bad relational schema. Model for the query, then verify with load tests.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1When would you still choose a relational database at high scale?
  2. 2How do you keep a search index in sync with the source of truth?
  3. 3What query patterns favor a wide-column store?
  4. 4Why can a document store make cross-entity transactions hard?

Say it in the interview

I choose from access patterns and consistency needs rather than from a SQL versus NoSQL label. Relational stores are strong when I need joins, constraints and multi-row transactions; partitioned stores are strong for simple key access and high write volume. Many real systems use several stores, with the relational database as the source of truth and caches, search and object storage as derived views. The synchronization and failure handling between them is the real design cost.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live System Design mock interview and get scored feedback on depth, clarity and confidence.