Locks in PostgreSQL and How to Avoid Contention

Locks are how PostgreSQL stops two transactions from stepping on each other. Most of the time they work invisibly, and you never think about them.