SQL vs NoSQL
SQL / Structured / Relational | NoSQL / unStructured / nonRelational | |
---|---|---|
Examples | Amazon(Aurora, RDS), MySQL, postgreSQL, mariaDB |
|
Types |
- ORDBMS(Object RDBMS):RDBMS build on OOD.Eg:PostGreSQL - RDBMS: mySQL |
a. KEY-VALUE DB: redis, Amazon dynamoDB, Voldemort, sled(rust) b. WIDE-COLUMN DB: Stores data as columns instead of rows. Eg: Cassandra, HBase c. DOCUMENT DB: Data is stored in documents(XML, JSON, binary) Eg: mongoDB, Amazon dynamoDB. d. GRAPH DB: Data is stored in form of graph.Eg: Neo4J, HyperGraphDB |
Advantage |
1. Super low latency 2. Data are unstructured, or you do not have any relational data 3. Store a massive amount of data 4. Need to serialize and deserialize data (JSON, XML, YAML, etc.) |
|
Disadvantage | 1. Join operations are not supported | |
Format | Table(Records searched using primary key)
|
<key, value> or xml or json or objects Example: Book data stored in mongoDB in json format
|
Huge Data Supoprt (~1TB) | No. Why? | yes |
Horizontal Scaling | Does not support Horizontal scaling efficiently | yes |
Tech Support | Good, query-writing:simple | Poor, query-writing:complex |
Schema | Fixed | Not fixed. We can have variable |
Use Cases |
- Schema Flexibility: Allows Flexible schema - Data Locality: Documents in a NoSQL database often stores all related information together. suitable case for Sharding - Horizontal Scaling Support: noSQL databases are designed to scale Horizontal |