Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.
Postgres
provides various lock modes to control concurrent
access to data in tables. Some of these lock modes are acquired by
Postgres
automatically before statement execution, while others are
provided to be used by applications. All lock modes (except for
AccessShareLock) acquired in a transaction are held for the duration
of the transaction.
In addition to locks, short-term share/exclusive latches are used
to control read/write access to table pages in shared buffer pool.
Latches are released immediately after a tuple is fetched or updated.
These locks are acquired when internal
fields of a row are being updated (or deleted or marked for update).
Postgres
doesn't remember any information about modified rows in memory and
so has no limit to the number of rows locked without lock escalation.
However, take into account that SELECT FOR UPDATE will modify
selected rows to mark them and so will results in disk writes.
Row-level locks don't affect data querying. They are used to block
writers to the same row only.