Locks

The MVCC model used in PostgreSQL makes locks less of an issue than in some other databases. However, high performance applications still need to be careful to minimize how often they take stronger locks, and performance tuning work will regularly require looking for situations where locking behavior is a bottleneck.

The details of how locking works in the database is described extensively at http://www.postgresql.org/docs/current/static/explicit-locking.html.

The other useful manual section is the description of the pg_locks view that lets you see all the active locks in the database, refer to http://www.postgresql.org/docs/current/static/view-pg-locks.html.

As there are far too many details involved in locking to cover all of them ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.