In addition to MVCC locking, one can control locking explicitly when MVCC does not provide a desirable behavior. Generally speaking, PostgreSQL provides three locking mechanisms, which are:
- Table-level locks
- Row-level locksÂ
- Advisory locks
In addition to MVCC locking, one can control locking explicitly when MVCC does not provide a desirable behavior. Generally speaking, PostgreSQL provides three locking mechanisms, which are:
Tables can be locked in several locking modes; the syntax of the LOCK statement is as follows:
LOCK [ TABLE ] [ ONLY ] name [ * ] [, ...] [ IN lockmode MODE ] [ NOWAIT ]
where lockmode is one of:
ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE
| SHARE | SHARE ROW EXCLUSIVE | EXCLUSIVE | ACCESS EXCLUSIVE
PostgreSQL locks the table implicitly when invoking an SQL command. It locks the table using the least restrictive...