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
- Why database connections are expensive
- Sizing a pool: the HikariCP formula and Little's Law
- The pods × pools explosion and connection poolers
- Connection leaks: how they happen and how to find them
- Long-running queries, layered timeouts and backpressure
- Lock types: row locks, table locks and the DDL lock queue
- Deadlocks: detection, prevention and retries
- Lock contention on hot rows
- Scenario deep dive: "remaining connection slots are reserved" — connections exhausted
Previous: Indexing & Query Optimization · Next: Replication, Read Replicas & Replication Lag