Re: Confusing deadlock report - Mailing list pgsql-general

From Tom Lane
Subject Re: Confusing deadlock report
Date
Msg-id 27469.1458135905@sss.pgh.pa.us
Whole thread Raw
In response to Confusing deadlock report  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: Confusing deadlock report  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
Thomas Kellerer <spam_eater@gmx.net> writes:
> 2016-03-12 13:51:29.305 CET [23912]: [2-1] user=arthur,db=prod,app=[unknown] DETAIL: Process 23912 waits for
ShareLockon transaction; blocked by process 24342.  
>         Process 24342 waits for ShareLock on transaction 39632974; blocked by process 23912.
>         Process 23912: UPDATE alpha SET some_flag = $1 WHERE (id = $2)
>         Process 24342: INSERT INTO bravo (..., alpha_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)

> Can the foreign key between bravo and alpha play a role here?

Absolutely.  The insert will need a sharelock on whatever alpha row the
new bravo row references.  Perhaps the newly-inserted row references some
row that 23912 previously updated (in the same transaction) while the
alpha row 23912 is currently trying to update was previously share-locked
by 24342 as a side effect of some previous insert?

            regards, tom lane


pgsql-general by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: Confusing deadlock report
Next
From: Adrian Klaver
Date:
Subject: Re: pg_dump crashing