Course
SQL & Databases for Builders
Schema design that survives refactors, index strategy that survives scale, and transactions that don't corrupt data at 3 a.m. Postgres-flavored SQL for people who ship.
Schema Design That Survives
Constraints as contracts, keys and types that age well, and migrations that don't take the site down.
- 01Constraints Are Contracts: NOT NULL, CHECK, UNIQUE, FKThe database is the only place every write passes through — put your invariants there, not in app code.25mOpen
- 02Keys and Data Types That Age WellIdentity vs UUID, timestamptz always, numeric for money, text over varchar, and jsonb with discipline.25mOpen
- 03Zero-Downtime Migrations on Big TablesWhich ALTERs rewrite the table, lock_timeout discipline, CONCURRENTLY indexes, and the NOT VALID / VALIDATE dance.35mMembers
Indexes and Query Plans
How B-trees actually answer queries, how to read EXPLAIN output, and which indexes are worth their write tax.
- 01How B-Tree Indexes Actually Answer QueriesLeftmost-prefix rules, composite column order, covering indexes, and matching ORDER BY to index ordering.30mMembers
- 02Reading EXPLAIN Like an OperatorEXPLAIN (ANALYZE, BUFFERS): estimate vs actual, scan and join types, and buffers as the honest metric.35mMembers
- 03Index Strategy: What to Build and What to SkipPartial and expression indexes, covering trade-offs, auditing unused indexes, and cleaning up bloat.30mMembers
Transactions and Query Patterns
Isolation anomalies that ship, query patterns that become incidents, and lock discipline that prevents deadlocks.
- 01Transaction Isolation and the Anomalies That ShipLost updates, write skew, what READ COMMITTED actually guarantees, and the atomic fixes that work.40mPremium
- 02Query Patterns That Become Tomorrow's IncidentN+1, OFFSET pagination, unbounded reads, functions on indexed columns, wildcard LIKE, and SELECT * on hot paths.35mPremium
- 03Locks, Deadlocks, and Transactions That Stay ShortConsistent lock ordering, no I/O inside transactions, FOR UPDATE scoping, and the SKIP LOCKED queue pattern.35mPremium