Backend
Database Deadlocks Explained: Why Two Transactions Freeze and How to Fix SQLSTATE 40P01
How circular lock waits happen in PostgreSQL, why the deadlock detector kills one transaction with 40P01, and how deterministic lock ordering prevents deadlocks completely.