// Master database design, normalization, query optimization, and selection between SQL, NoSQL, and specialized databases.
| name | database-design |
| description | Master database design, normalization, query optimization, and selection between SQL, NoSQL, and specialized databases. |
Design efficient, scalable databases for any use case.
1NF - Atomic values, no repeating groups 2NF - No partial dependencies 3NF - No transitive dependencies BCNF - Every determinant is a candidate key
Denormalization - Trade normalization for performance
Primary Keys
Foreign Keys
Indexes
EXPLAIN Plan
EXPLAIN SELECT * FROM users WHERE email = 'test@example.com';
Optimization Techniques
ACID Properties
Isolation Levels
Structure
{
"_id": ObjectId(),
"name": "John",
"email": "john@example.com",
"posts": [
{ "title": "...", "date": "..." }
]
}
Advantages
Disadvantages
Use Cases
Data Structures
InfluxDB, Prometheus
| Type | SQL | MongoDB | Redis | Cassandra |
|---|---|---|---|---|
| Transactions | ✓ | Limited | ✗ | ✗ |
| Scaling | Vertical | Horizontal | Horizontal | Horizontal |
| Consistency | Strong | Eventual | Strong | Eventual |
| Query | SQL | JSON | Commands | CQL |
Master-Slave
Multi-Master
Shard Key Selection
Challenges
JSONB - Efficient JSON storage Full-Text Search - Text indexing Arrays - Array data type Ranges - Range types Extensions - UUID, PostGIS, etc.
Replication
Configuration
Backup Types
Recovery
Key Metrics