Re: Updates, ShareLocks, RowExclusiveLocks, and deadlocks

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Updates, ShareLocks, RowExclusiveLocks, and deadlocks
Дата
Msg-id 19670.1335378918@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Updates, ShareLocks, RowExclusiveLocks, and deadlocks  (Ben Chobot <bench@silentmedia.com>)
Ответы Re: Updates, ShareLocks, RowExclusiveLocks, and deadlocks
Список pgsql-general
Ben Chobot <bench@silentmedia.com> writes:
> We have a few daemon process that constantly pull batches of logs from a work queue and then insert into or update a
singletable in a single transaction, ~1k rows at a time. I've been told the transaction does nothing other than insert
andupdate on that table, and I can verify the table in question has no triggers. This is 9.1.3. 
> What we've noticed is that most updates come with a RowExclusiveLock, according to pg_locks, which is what you'd
expectfrom the manual. Unfortunately, sometimes, some of those update transactions have ShareLocks, which doesn't make
anysense to us, because we're not taking explicit locks and the manual claims ShareLocks only automatically come from
indexcreation, which we're also not doing explicitly. This is a problem because it's showing up as deadlocks, every few
minutes.

You'd really need to provide more information here, but what I suspect
is that you're seeing row-level locks in process of being acquired.
For implementation reasons that type of activity will transiently
try to acquire ShareLock on another transaction's XID.  Or this might
be something different, but without seeing a full copy of the pg_locks
rows you're talking about, it's hard to be sure.  In any case, I'd
speculate that the underlying cause is conflicting updates on the same
row, and/or foreign-key-related row locks.

            regards, tom lane

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

Предыдущее
От: Ben Chobot
Дата:
Сообщение: Updates, ShareLocks, RowExclusiveLocks, and deadlocks
Следующее
От: "George Weaver"
Дата:
Сообщение: Re: Using copy with a file containing blank rows