System Design
  • Introduction
  • System Design Process
  • System Design Systematic Approach
  • System Design Topics
  • System Design Interview Tips
  • Object Oriented Design
  • System Design Problems
    • Designing an API Rate Limiter
    • Design News Feed
    • Design Recommendation System
    • Design Photo Sharing App
    • Design Location Based App
    • Design Messenger App
    • Design Twitter
    • Design Uber Lyft
    • Design Surge Pricing
  • Architect's Toolbox
    • Cache Design
    • Database and Cache
    • Pull vs Poll
    • Geo Location
    • Storage Estimation
    • ID Generator
    • Latency Numbers
    • Encoding Decoding Encryption Decryption
  • Systems Design Glossary
    • Consistent Hashing
    • Sharding or Partitioning
    • Database Indexes
    • Proxies
    • Caching
    • Queues
    • SQL vs. NoSQL
    • CAP Theorem
    • Distributed Messaging System
    • Long-Polling vs WebSockets vs Server-Sent Events
    • Producer and Consumer
    • Latency, Bandwidth and Throughput
    • Microservices Architecture
    • RESTful API
    • Concurrent Programming
  • Distributed System Resources
    • Distributed System Notes
  • Reference
Powered by GitBook
On this page
  • SQL
  • NoSQL
  • Most common types of NoSQL
  • High Level Differences between SQL and NoSQL
  • Which one to use?
  • Reasons to use SQL database
  • Reasons to use NoSQL database

Was this helpful?

  1. Systems Design Glossary

SQL vs. NoSQL

SQL and NoSQL - or relational databases and non-relational databases.

SQL

Relational databases are structured and have predefined schemas.

Relational databases store data in rows and columns.

NoSQL

Non-relational databases are unstructured, distributed and have a dynamic schema

Most common types of NoSQL

Key-Value Stores: Data is stored in an array of key-value pairs.

e.g. Redis, Voldemort and Dynamo

Document Databases: In these databases data is stored in documents

e.g. CouchDB, MongoDB

Wide-Column Databases: Instead of ‘tables,’ in columnar databases we have column families, which are containers for rows. (Unlike relational databases, we don’t need to know all the columns up front, and each row doesn’t have to have the same number of columns.)

e.g. Cassandra and HBase.

Graph Databases: These databases are used to store data whose relations are best represented in a graph.

e.g. Neo4J and InfiniteGraph

High Level Differences between SQL and NoSQL

Storage SQL - stores data in tables NoSQL - different data storage models, such as KV-store, document, graph, columnar

Schema SQL - fixed schema, column must be decided; alter schema involves modifying the whole database NoSQL - schemas are dynamic

Querying SQL - SQL (structured query language) NoSQL - Unstructured query language, different databases, different syntax

Scalability SQL - most commonly, vertically scalable (increasing horsepower of hardware); harder to scale Relational DB across multiple servers NoSQL - horizontally scalable; adding more servers; many NoSQL DB also distribute data automatically

Reliability or ACID Compliancy (Atomicity, Consistency, Isolation, Durability)

SQL - vast majority of relational databases are ACID compliant NoSQL - most NoSQL solutions sacrifice ACID compliance for performance and scalability

Which one to use?

Reasons to use SQL database

  • We need to ensure ACID compliance.

  • Your data is structured and unchanging.

e.g. e-commerce and financial applications

Reasons to use NoSQL database

  • Storing large volumes of data that often have little to no structure.

  • Making the most of cloud computing and storage.

  • Rapid development.

PreviousQueuesNextCAP Theorem

Last updated 5 years ago

Was this helpful?