Re: Deadlock error in INSERT statements

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: Deadlock error in INSERT statements
Дата
Msg-id 1254928125.3372.435.camel@pcd12478
обсуждение исходный текст
Ответ на Deadlock error in INSERT statements  (Gnanam <gnanam@zoniac.com>)
Список pgsql-hackers
On Wed, 2009-10-07 at 16:34 +0200, Gnanam wrote:
> NOTE: I've seen "deadlock" errors in UPDATE statement but why it is throwing
> in INSERT statements.

It is because of the foreign key. Inserting a child row will lock the
corresponding parent row, and if you insert multiple rows with different
parents in the same transaction, and do that in different concurrent
transactions but in different order of the parent rows, you can get a
deadlock. If you keep in mind that the parent row is locked on the
insert of a child row, you will figure out what's happening...

BTW, I don't think the "hackers" list is the right one for this kind of
question, better use the "general" list...

Cheers,
Csaba.




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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Deadlock error in INSERT statements
Следующее
От: Joshua Tolley
Дата:
Сообщение: Re: Feature Suggestion: PL/Js