1
SQL vs NoSQL
Database
| SQL (relational) | NoSQL |
|---|---|
| Tables with a fixed schema | Flexible schema: document, key-value, column, graph |
| Scales vertically (bigger server) | Scales horizontally (more servers, sharding) |
| Strong ACID transactions | Often BASE / eventual consistency |
| Complex joins and queries | Fast simple reads/writes at huge scale |
| MySQL, PostgreSQL, Oracle | MongoDB, Redis, Cassandra, Neo4j |
CAP theorem: a distributed system can guarantee only two of Consistency, Availability and Partition tolerance at the same time.