Back to TutorialsSystem Design · Chapter 5

SQL vs NoSQL: Choosing the Right Database

Database choice is rarely about "which is better" — it's about which trade-offs fit your access patterns.

When SQL Wins

Relational databases (PostgreSQL, MySQL) give you strong consistency, well-defined schemas, and powerful joins. They're the right default when your data is highly relational and you need transactional guarantees — payments, inventory, bookings.

When NoSQL Wins

Document stores (MongoDB) suit flexible, evolving schemas. Key-value stores (DynamoDB, Redis) suit extremely high-throughput, simple-lookup workloads. Wide-column stores (Cassandra) suit massive write volumes across distributed nodes. Graph databases (Neo4j) suit deeply relational, traversal-heavy data like social networks.

It helps to connect each choice back to a concrete symptom: if your team keeps adding migrations because the schema changes every sprint, that's a signal toward a document store. If a single query is doing five joins to answer "who are this user's friends of friends," that's a signal toward a graph database — relational joins get expensive fast on deeply traversal-heavy queries.

The Interview Answer

State your access pattern first ("we read by user ID far more than we query across users"), then justify the database choice from that pattern — not the other way around.

You Can Use Both

Polyglot persistence — using different databases for different parts of the same system — is common and not a red flag. A social platform might use PostgreSQL for user accounts and billing, Redis for session data, and a graph database for the friend/follower graph.

Don't Skip Indexing

Whichever database you pick, mention indexing on your most common query patterns. It's an easy point to earn and an easy one to lose by omission — interviewers notice when a candidate designs a schema but never discusses how queries against it will actually perform.

ACID vs BASE, Briefly

SQL databases are typically described as ACID (Atomicity, Consistency, Isolation, Durability) — strong guarantees suited to transactional data. Many NoSQL systems favor BASE (Basically Available, Soft state, Eventual consistency) — looser guarantees traded for availability and scale. You don't need to recite the acronyms, but knowing which guarantee your chosen database leans toward helps you answer follow-up questions about consistency confidently.

Ready to put this into practice?

Upload your resume and get matched with a verified referrer today.

Get Started