Map of Content — Database Mastery
Xem Roadmap để hiểu lộ trình 16 tuần. Khóa này phối hợp với MOC-System-Design — SD tiếp cận DB từ góc distributed/architecture, khóa này từ góc engineering + operations + workload specialization.
Phase 1: Relational Deep Dive
Master 80% bài toán thực tế trước khi đi rộng.
- Tuan-01-DB-Internals-Refresh — Storage engine, page layout, WAL, buffer pool, MVCC mechanics
- Tuan-02-Schema-Design-Normalization — Normalization, denormalization, key strategy, anti-pattern
- Tuan-03-Indexing-Mastery — B-tree, covering, partial, expression, GIN/GiST/BRIN/Hash, bloat
- Tuan-04-Query-Optimization-EXPLAIN — EXPLAIN ANALYZE, statistics, join algorithm, CTE, window function
- Tuan-05-Transactions-Locking — ACID, isolation levels, MVCC visibility, deadlock, optimistic/pessimistic
Phase 2: Operational Excellence
Production-grade DB operations — backup, migration, observability.
- Tuan-06-Connection-Pooling-PgBouncer — Pool sizing, transaction vs session pooling, RDS Proxy
- Tuan-07-Backup-PITR-DR — pg_basebackup, WAL archiving, PITR, RPO/RTO, restore drill
- Tuan-08-Zero-Downtime-Migration — Expand-contract, gh-ost, pt-osc, online DDL, dual-write
- Tuan-09-DB-Observability-Tuning — pg_stat_statements, autovacuum, bloat, slow query, USE method
Phase 3: NoSQL & Specialized Stores
Khi nào đặt relational xuống.
- Tuan-10-Redis-Mastery — Data structures, persistence, Cluster, Lua scripting, anti-pattern
- Tuan-11-DynamoDB-Cassandra — Single-table design, partition key, LSI/GSI, tunable consistency
- Tuan-12-MongoDB-Document-DB — Document model, aggregation pipeline, sharding, anti-pattern
Phase 4: Modern Workload (2024-2026)
AI, realtime analytics, full-text search là baseline.
- Tuan-13-Search-Engines-ES — Inverted index, BM25, analyzer, mapping, ES vs Postgres FTS
- Tuan-14-OLAP-Columnar-ClickHouse — Columnar storage, vectorized exec, materialized view, OLAP vs OLTP
- Tuan-15-Vector-DB-AI — pgvector vs Qdrant vs Pinecone, HNSW/IVF, hybrid search, RAG pipeline
Phase 5: Application Patterns
Pattern application-level quyết định 50% performance.
- Tuan-16-ORM-CQRS-Multi-Tenancy — N+1, DataLoader, CQRS, event sourcing trade-off, RLS multi-tenancy
Bonus Chapters (chiều sâu hoặc xu hướng)
- Tuan-Bonus-Postgres-Partitioning — Range/list/hash, pruning, pg_partman, attach/detach
- Tuan-Bonus-Time-Series-DB — TimescaleDB, InfluxDB v3, Prometheus, VictoriaMetrics
- Tuan-Bonus-Graph-DB-Neo4j — Property graph, Cypher, GDS, Memgraph, vector + graph
- Tuan-Bonus-Embedded-DBs — SQLite (Litestream), DuckDB, RocksDB, LanceDB
- Tuan-Bonus-CDC-Debezium — Logical replication, Debezium, Schema Registry, outbox
- Tuan-Bonus-Distributed-SQL-Engineering — CockroachDB, TiDB, YugabyteDB, Aurora DSQL, Spanner
- Tuan-Bonus-MySQL-Internals — InnoDB, gap lock, GTID, parallel replication, Vitess
- Tuan-Bonus-Lakehouse-Engineering — Iceberg V3, Z-ordering, catalog wars (Polaris/Unity)
- Tuan-Bonus-DB-Security-Compliance — Encryption layers, RLS, audit, GDPR, PCI
Case Studies — Design Data Layer
Mỗi case study là một bài tập tổng hợp data layer cho một loại sản phẩm.
- Case-Design-Data-Ecommerce — Product catalog + order ACID + inventory concurrency + recommendation
- Case-Design-Data-SaaS-Multi-tenant — RLS vs schema-per-tenant, noisy neighbor, tenant migration
- Case-Design-Data-Realtime-Analytics — Kafka → ClickHouse, pre-aggregation, hot/cold split
- Case-Design-Data-AI-RAG — Document store + embedding pipeline + vector index + hybrid retrieval
- Case-Design-Migrate-Monolith-DB — DB-per-service, dual-write, CDC, data ownership
Cross-Reference với System Design Mastery
| Topic | DB Mastery (engineering) | System Design Mastery (architecture) |
|---|---|---|
| Sharding | Tuan-03-Indexing-Mastery + shard key design ở Tuan-08-Zero-Downtime-Migration | Tuan-07-Database-Sharding-Replication |
| Replication | Tuan-09-DB-Observability-Tuning (replication lag) | Tuan-07-Database-Sharding-Replication, Tuan-Bonus-Consensus-Raft-Paxos |
| Consistency | Tuan-05-Transactions-Locking (MVCC, isolation) | Tuan-Bonus-Consistency-Models-Isolation |
| Distributed SQL | Tuan-Bonus-Distributed-SQL-Engineering | Tuan-Bonus-Multi-Region-Active-Active-DSQL |
| Vector DB | Tuan-15-Vector-DB-AI (HNSW, pgvector tuning) | Tuan-Bonus-LLM-Serving-Infrastructure |
| Lakehouse | Tuan-Bonus-Lakehouse-Engineering | Case-Design-Modern-Data-Lakehouse |
| Outbox/CDC | Tuan-Bonus-CDC-Debezium | Tuan-Bonus-Outbox-Pattern |
| Multi-tenancy | Tuan-16-ORM-CQRS-Multi-Tenancy (RLS impl) | Tuan-Bonus-Multi-Tenancy-SaaS-Patterns |
| Security | Tuan-Bonus-DB-Security-Compliance | Tuan-15-Data-Security-Encryption |
Attachments
- explain-cheatsheet — Cheatsheet đọc EXPLAIN ANALYZE Postgres + MySQL
- index-decision-tree — Cây quyết định chọn loại index
- db-choice-matrix — Matrix chọn DB theo workload
- lab-docker-compose — Docker compose all-in-one cho lab
- postgres-extensions-ecosystem — Map đầy đủ extensions: bundled, geo, TS, vector, ops
Maps & Index
- Roadmap — Lộ trình 16 tuần + bonus + case studies
- References — Sách / paper / blog / course uy tín theo chủ đề (sẽ build dần)
Cập nhật lần cuối: 2026-05-16