System Design
  • System Design 101
  • Storage
    • SQL
    • NoSQL
    • SQL vs NoSQL
    • Timeseries Databases
  • Queues
    • Message Queue
    • RabbitMQ vs Apache Kafka
  • Concurrency
    • Concurrency
    • Concurrency in Databases
Powered by GitBook
On this page
  • Differences
  • For More Reading

Was this helpful?

  1. Storage

SQL vs NoSQL

So after reading about SQL and NoSQL, the common questions that comes in mind are

What are the differences between the two ?

When do we choose SQL over NoSQL or vice-versa ?

What are the properties needed to decide the type of datastore to use in your application ?

Differences

  • SQL databases are not suitable for hierarchical data storage while NoSQL databases are.

  • SQL supports ACID, while NoSQL doesn't.

  • SQL databases support Joins, while NoSQL joins can only be achieved at application layer.

  • SQL Databases are strongly consistent, while NoSQL databases are highly available.

  • SQL databases are preferred when the requirement is of correct and consistent data, while NoSQL databases rely on fast data and can compromise on accuracy

  • SQL databases are vertically scalable while NoSQL are horizontally scalable.

Criteria

SQL/NoSQL

High number of reads/writes (High QPS)

NoSQL

High Concurrency

NoSQL

Low Reads/Writes (Few thousands per second)

SQL

Joins Needed

SQL

Strong Consistency

SQL

High Availability

NoSQL

Transaction Properties

SQL

High Commodity Hardware (Vertically Scalable)

SQL

Low Commodity Machines (Horizontally Scalable)

NoSQL

Sharding

NoSQL

Partitioning

SQL

Partitioning: Partitioning is dividing large data into multiple tables in a single database. Vertical partitioning is dividing data by columns into multiple tables (normalisation), while horizontal partitioning is dividing data by rows into multiple tables.

Sharding: Sharding is dividing large data into smaller chunks across multiple machines. There are two types of sharding: Vertical sharding where the data is divided by columns across machines where horizontal sharding is dividing data by rows across machines.

For More Reading

  • SQL vs NoSQL

PreviousNoSQLNextTimeseries Databases

Last updated 4 years ago

Was this helpful?