PostgreSQL & Database Design
Master relational database modeling, normalization, B-Tree and GIN indexes, EXPLAIN query plans, ACID transactions, JSONB, CTEs, and window functions.
What you'll build & master
- ✓ Design normalized 3NF schemas with foreign keys and check constraints
- ✓ Read EXPLAIN plans and choose composite, partial, and covering indexes
- ✓ Prevent race conditions using transactions, isolation levels, and row locks
- ✓ Write production analytics queries using CTEs, window functions, and JSONB
Course Syllabus
Schema Design
- 19 min
Relational Modeling, Primary & Foreign Keys
Model real-world entities cleanly using surrogate vs natural keys, foreign key constraints, and ON DELETE actions.
- 29 min
Normalization (1NF, 2NF, 3NF) & Denormalization
Eliminate update anomalies with First, Second, and Third Normal Form, and know when controlled denormalization makes sense.
- 38 min
Data Types, CHECK Constraints & Enums
Pick precise PostgreSQL data types (NUMERIC for money, TIMESTAMPTZ for timestamps) and guard data quality with CHECK constraints.
Indexing & Performance
- 110 min
B-Tree Indexes & Selectivity
Understand how B-Tree indexes turn O(N) sequential scans into O(log N) index lookups and when an index is ignored.
- 210 min
Composite Indexes, Column Order & Partial Indexes
Master leftmost-prefix ordering in multi-column indexes and shrink index size dramatically with partial indexes.
- 310 min
Reading EXPLAIN Plans & Fixing Slow Queries
Diagnose slow SQL by inspecting sequential scans, index scans, nested loops, and hash joins with EXPLAIN.
Transactions & Concurrency
- 19 min
ACID Transactions, COMMIT & ROLLBACK
Group multi-step mutations into atomic transactions so partial failures never corrupt business state.
- 210 min
MVCC, Isolation Levels & Row-Level Locking
Prevent lost updates and double-spending using PostgreSQL MVCC, READ COMMITTED vs SERIALIZABLE, and SELECT FOR UPDATE.
Advanced SQL
- 19 min
CTEs (WITH Clauses) & Recursive Queries
Break complex multi-stage SQL into readable Common Table Expressions (CTEs) and traverse trees with WITH RECURSIVE.
- 210 min
Window Functions: ROW_NUMBER, RANK & Running Totals
Compute rankings, top-N per group, running totals, and moving averages without collapsing rows via OVER (PARTITION BY ...).
- 39 min
JSONB, GIN Indexes & Hybrid Schemas
Store flexible metadata alongside relational columns using JSONB and query nested keys cleanly.