ML SystemPart 3: DataChapter 3
Data CH.03 ~30 min
Data Strategies
SQL vs NoSQL, Sharding, Replication, and ACID.
SQLNoSQLShardingReplicationACID
- Understand ACID principles and their importance in financial systems.
- Analyze when to implement sharding on a database.
- Compare different NoSQL types (Document, Key-Value, Graph).
- Design a data storage strategy that combines SQL and NoSQL.
01 Relational Databases (RDBMS) & ACID Viz
Definition
ACID
A standard for transactions that guarantees every database operation runs safely and consistently.
- **Atomicity**: Transactions must succeed completely or fail completely.
- **Consistency**: The database moves from one valid state to another valid state.
- **Isolation**: Transactions running simultaneously do not interfere with each other.
- **Durability**: Once data is stored, it remains even if the system crashes.
Normalization
The process of organizing data to reduce redundancy.
02 SQL Scaling Techniques: Replication & Sharding
| Technique | Description | When to Use |
|---|---|---|
| Replication | Copy data to many servers | High read traffic (read-heavy) |
| Federation | Split DB by function | System has clear modules (User, Product) |
| Sharding | Split tables horizontally | A single table is too large for one disk |
| Denormalization | Add data duplication | Need super-fast read performance |
Various techniques for scaling SQL databases.
The Danger of Sharding
Sharding adds immense complexity to your application code. Do this only if other techniques (like replication or query optimization) are no longer sufficient.
03 The World of NoSQL: Flexibility & Massive Scale
- **Key-Value**: Very fast, suitable for cache or sessions.
- **Document**: Flexible, suitable for product data or user profiles.
- **Wide-Column**: Good for large data (big data) that grows continuously.
- **Graph**: Best for data with complex interconnections (social media).
Choose SQL for financial/transactional data; Choose NoSQL for large/unstructured data.Deeper InsightMost modern systems use both (Polyglot Persistence). Click to collapse
Key Takeaways
- 1ACID is the gold standard for transaction security in SQL databases.
- 2Replication improves read performance, while Sharding improves storage capacity.
- 3NoSQL offers easier horizontal scalability compared to SQL.
- 4The BASE pattern in NoSQL allows the system to continue functioning even if data is not fully synced.
CH.03
Chapter Complete
Chapter Progress
Reading
Exercise
Interact with the visualization
Quiz
Data Strategy Quiz
Test your understanding of relational databases, NoSQL, replication, and sharding.
Ready to test your knowledge?
5 questionsRandomized from pool70% to pass