Re: Tracking down a deadlock

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Tracking down a deadlock
Дата
Msg-id 6605.1241399309@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Tracking down a deadlock  (Bill Moseley <moseley@hank.org>)
Ответы Re: Tracking down a deadlock  (Bill Moseley <moseley@hank.org>)
Список pgsql-general
Bill Moseley <moseley@hank.org> writes:
> Then when I run the test script (which runs the same transaction in two
> processes at the same time) and get a deadlock the same query is shown twice
> both with "waiting" set true:

>         UPDATE account set foo = 123 where id = $1

> And if I remove that update from the transaction I no longer have the deadlock.
> So, it seems like that is the problem update.

> Is postgresql telling me that it's deadlocked on two transactions trying to run
> that same update?

Looks like it.

> There are no other updates to that account table in the transaction, so I'm
> confused how that is causing a deadlock.

Is there more than one row with the target id?  Does the account table
have any foreign-key references to or from it?  It's sometimes possible
to get a deadlock associated with trying to lock FK-referenced rows that
several updated rows have in common.

            regards, tom lane

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

Предыдущее
От: Bill Moseley
Дата:
Сообщение: Re: Tracking down a deadlock
Следующее
От: PostGre Newbie
Дата:
Сообщение: Re: Online Backups PostGre