Relational Databases (SQL)
Are structured and have predefined schemas.
Non-relational Databases
Are unstructured, distributed and have a dynamic schema.
High level differences
| Property | SQL | NoSQL |
|---|---|---|
| Storage | Data stored in tables | Different data storage models such as document, key-value, graph and column-oriented (used mainly for analytics) |
| Schema | Fixed | Dynamic |
| Query | SQL language | queries based on documents and have different syntax/DSL by DB |
| Scalability | Vertical | Horizontal |
| Reliability | ACID | Non-ACID for performance and scalability |
Reasons
For SQL
- Structured data with strict schema
- Relational data
- Need for complex joins
- Transactions
- Lookups by index are very fast
For NoSQL
- Dynamic or flexible schema
- Non-relational data
- No need for complex joins
- Very data-intensive workload
- Very high throughput for IOPS