system-design-primer/resources/noat.cards/13 SQL or NoSQL.md

1.4 KiB

+++ noatcards = True isdraft = False +++

SQL or NoSQL

Reasons for SQL:

Source: Transitioning from RDBMS to NoSQL

  • Structured data
  • Strict schema
  • Relational data
  • Need for complex joins
  • Transactions
  • Clear patterns for scaling
  • More established: developers, community, code, tools, etc
  • Lookups by index are very fast

Reasons for NoSQL:

Source: Transitioning from RDBMS to NoSQL

  • Semi-structured data
  • Dynamic or flexible schema
  • Non relational data
  • No need for complex joins
  • Store many TB (or PB) of data
  • Very data intensive workload
  • Very high throughput for IOPS

Sample data well-suited for NoSQL:

  • Rapid ingest of clickstream and log data
  • Leaderboard or scoring data
  • Temporary data, such as a shopping cart
  • Frequently accessed ('hot') tables
  • Metadata/lookup tables

Source(s) and further reading: SQL or NoSQL