Re: Updates, ShareLocks, RowExclusiveLocks, and deadlocks

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Updates, ShareLocks, RowExclusiveLocks, and deadlocks
Дата
Msg-id 27303.1335383106@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Updates, ShareLocks, RowExclusiveLocks, and deadlocks  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> I think what you're missing here is that RowExclusiveLocks are taken by
> marking the row itself.

More specifically: row-level locks are not reflected in pg_locks at all.
A RowExclusiveLock entry in pg_locks reflects a *table* level lock,
which is taken by any INSERT/UPDATE/DELETE command on the table,
independently of how many rows it modifies (even zero).  The purpose
of that type of lock is to prevent concurrent DDL changes on the table,
not to serialize the row-level operations.

There are locks that will show up in pg_locks that are taken transiently
when attempting to mark a row modified, but they don't persist after the
mark has been made, and the details have changed from time to time in
different PG versions.  So I'd suggest testing it to see exactly what
you get.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Ben Chobot
Дата:
Сообщение: Re: Updates, ShareLocks, RowExclusiveLocks, and deadlocks
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: how robust are custom dumps?