system-design-primer/resources/noat.cards/SQL or NoSQL.md

51 lines
1.4 KiB
Markdown
Raw Normal View History

2021-03-21 13:45:39 +03:00
+++
noatcards = True
isdraft = False
+++
# SQL or NoSQL
## Reasons for SQL:
![](https://camo.githubusercontent.com/a6e2e844765c9d5382d9c9b64ef7693977981646/687474703a2f2f692e696d6775722e636f6d2f775847714735662e706e67)
[Source: Transitioning from RDBMS to NoSQL](https://www.infoq.com/articles/Transition-RDBMS-NoSQL/)
- Structured data
- Strict schema
- Relational data
- Need for complex joins
- Transactions
- Clear patterns for scaling
- More established: developers, community, code, tools, etc
- Lookups by index are very fast
## Reasons for NoSQL:
![](https://camo.githubusercontent.com/a6e2e844765c9d5382d9c9b64ef7693977981646/687474703a2f2f692e696d6775722e636f6d2f775847714735662e706e67)
[Source: Transitioning from RDBMS to NoSQL](https://www.infoq.com/articles/Transition-RDBMS-NoSQL/)
- Semi-structured data
- Dynamic or flexible schema
- Non relational data
- No need for complex joins
- Store many TB (or PB) of data
- Very data intensive workload
- Very high throughput for IOPS
## Sample data well-suited for NoSQL:
- Rapid ingest of clickstream and log data
- Leaderboard or scoring data
- Temporary data, such as a shopping cart
- Frequently accessed ('hot') tables
- Metadata/lookup tables
## Source(s) and further reading: SQL or NoSQL
- [Scaling up to your first 10 million users](https://www.youtube.com/watch?v=vg5onp8TU6Q)
- [SQL vs NoSQL differences](https://www.sitepoint.com/sql-vs-nosql-differences/)