For backend engineers: make slow queries fast and keep production Postgres healthy.
Reach for this when a production database is slow or strained and you need a verifiable fix, not folklore. It walks the real diagnose-to-resolve path: catch N+1s in your ORM, read an EXPLAIN plan down to the bottleneck node, advise the right index, rewrite pathological SQL, decide when to partition, size connection pools, ship migrations with zero-downtime locking, and chase down stale reads from replica lag. Every fix is EXPLAIN-checkable, so you ship the change knowing it actually moved the number.
Click to play with sound.
Arranged in the author's recommended order. Walk through them in sequence, or open any one on its own.
Detect ORM loop-of-queries (N+1) patterns from query logs and eliminate them with batched eager loading, keeping the N+1s that are cheap. Use when a list endpoint is slow, a request issues many near-identical SELECTs differing only by an id, query logs show repeated SELECTs in a loop, or a tool like the bullet gem flags an N+1 in ActiveRecord, Prisma, SQLAlchemy, or Hibernate.
View skillRead a captured EXPLAIN ANALYZE plan, name the single bottleneck node, and prescribe a targeted fix for it. Use when a specific query is slow and you have (or can capture) its execution plan from Postgres or MySQL and need to know WHICH node is burning the time and why.
View skill