Course · 5 lessons ~48 hr Intermediate

Query Optimization & Performance

Query Optimization & Performance covers: Essential PostgreSQL, Learn PostgreSQL. Master the art and science of making databases fast. Indexing strategies, query plan analysis, connection pooling, partitioning, and the PostgreSQL-specific performance toolkit. This is the most directly career-impactful module in the entire curriculum. N+1 queries, counter caches, database-level constraints vs model validations, advisory locks, SELECT FOR UPDATE — these are the daily performance decisions of a Rails engineer. After this module, you understand why includes fixes N+1 (it generates a second query with WHERE id IN (...) or a LEFT OUTER JOIN), why counter_cache exists (because COUNT(*) in PostgreSQL must scan all visible tuples due to MVCC), why find_each exists (because loading 1M records into memory kills your process), and why strong_migrations rejects add_index without algorithm: :concurrently (because CREATE INDEX takes an exclusive lock on the table).

reading · we frame, you read MIT or the canonical taught · we author, no canonical fits ↺ spirals back to earlier lessons
Course locked

Complete Database Design & Modeling first.

This course unlocks once you've finished its prerequisite. Open prerequisite →

5 lessons. Read in order; spiral back when you need to. By the end you'll have used the core ideas twice — once on the abstract, once on something you'll meet at work next week.