Connection Pooling, Lock Contention & Deadlocks

Why DB connections are expensive, sizing pools with Little's Law, the pods × pool explosion, PgBouncer modes, leaks and timeouts, backpressure, row/table locks, SKIP LOCKED, deadlocks and hot-row contention — plus the "connections exhausted" incident in depth.

About 105 minutes · 15 exam questions · 9 interview questions · 2 code labs

What you will learn

  1. Why database connections are expensive
  2. Sizing a pool: the HikariCP formula and Little's Law
  3. The pods × pools explosion and connection poolers
  4. Connection leaks: how they happen and how to find them
  5. Long-running queries, layered timeouts and backpressure
  6. Lock types: row locks, table locks and the DDL lock queue
  7. Deadlocks: detection, prevention and retries
  8. Lock contention on hot rows
  9. Scenario deep dive: "remaining connection slots are reserved" — connections exhausted

Previous: Indexing & Query Optimization · Next: Replication, Read Replicas & Replication Lag