Re: Frequent 'deadlock detected' in 7.4 ... or just my bad code?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Frequent 'deadlock detected' in 7.4 ... or just my bad code?
Дата
Msg-id 11570.1081178034@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Frequent 'deadlock detected' in 7.4 ... or just my bad code?  ("Marc G. Fournier" <scrappy@postgresql.org>)
Ответы Re: Frequent 'deadlock detected' in 7.4 ... or just my bad  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список pgsql-admin
"Marc G. Fournier" <scrappy@postgresql.org> writes:
>   Now, the scripts are wrap'd in a BEGIN/END ... if a file fails to be
> loaded, I want the whole thing to rollback ... the deadlock itself, I'm
> presuming, is because two servers are trying to update the same
> $ip_id/$port/$company_id record, at the same time ...

Actually, the problem is more likely that two servers try to update two
different rows in opposite orders.  It's not possible to deadlock when
only one lock is involved.

You could work around this by ensuring that all sessions update rows in
a consistent order; for instance, at the beginning of a transaction sort
your intended updates by primary key and then apply in that order.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Do Petabyte storage solutions exist?
Следующее
От: "Anjan Dave"
Дата:
Сообщение: Use 7.4.1's pg_dump in 7.2.4?