PostgreSQL uses locks to coordinate concurrent access and prevent conflicts. Thanks to MVCC, reads generally don't need locks (readers don't block writers), but writes acquire row-level locks, and various lock types coordinate operations. Understanding locking helps avoid contention and deadlocks.
MVCC means reads usually don't lock
Because of MVCC, plain SELECTs do NOT take row locks — they read a consistent snapshot.
→ Readers don't block writers, writers don't block readers (a key Postgres advantage).
Locking mainly comes into play for WRITES and explicit locking.
