Skip to content
We areTOP 1%

How do you choose between a SQL and a NoSQL database?

EasyConceptDatabases: Replication & Sharding
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Choose a relational (SQL) database when data is structured and related and you need joins, ACID transactions and strong consistency. Choose a NoSQL database when you need flexible schemas, very high write throughput, or easy horizontal scaling for simple access patterns.

  • SQL (PostgreSQL, MySQL): orders, payments, inventory and user accounts.
  • Key-value (Redis, DynamoDB): sessions, caches and lookups by ID.
  • Wide-column (Cassandra, HBase): high-volume, time-ordered writes such as messages, events and metrics.
  • Document (MongoDB): nested records with varying fields, such as product catalogues. Graph (Neo4j): relationship-heavy queries.
  • The boundary is blurring: many SQL databases can be sharded, and many NoSQL stores offer transactions. Choose by access pattern, not by trend.

More in Databases: Replication & Sharding

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account