Skip to content

Symptom triage

Production doesn't page you about "isolation anomalies" — it pages you about latency, weird numbers, and full connection pools. This chapter is the site in runbook order: start from the symptom, run one query, land on the mechanism you already learned.

SymptomUsual suspectStart here
Queries hang; latency spikes in burstsA lock queue behind one long holder — often an idle transaction or unguarded DDLWho is blocking whom, Table locks & DDL
Numbers don't add up; no errors loggedA lost update or write skew — the silent onesGrep the code for read-modify-write; fix with these patterns
Connections pile up until the pool is emptySessions stuck idle in transactionLong & idle transactions, ORM pitfalls
Table keeps growing though rows are deletedDead tuples; VACUUM starved by a long transactionBloat & vacuum health
Sporadic 40001 / 40P01 errors under loadSerialization failures and deadlocks — expected, must be retriedLogs & counters, the retry wrapper
Locks held but no session owns themAn orphaned prepared transactionSELECT gid FROM pg_prepared_xacts;

Two habits make every row of this table easier. Name your sessions: every scenario on this site sets application_name, and every triage query returns it, so one line in your connection setup buys you readable pg_stat_activity forever. And alert before the page, because most of these symptoms have a leading indicator, and the alerting checklist lists the handful worth watching.

Further reading

MIT Licensed · Every transcript on this site was generated by a real database run against MySQL 8.4.10 and PostgreSQL 18.4 at bd6f201, and re-proven through psycopg and PyMySQL.