Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marc Munro <marc(at)bloodnok(dot)com>
Cc: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)
Date: 2007-02-12 05:10:28
Message-ID: 22565.1171257028@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marc Munro <marc(at)bloodnok(dot)com> writes:
> Consider a table C containing 2 child records C1 and C2, of parent P.
> If transaction T1 updates C1 and C2, the locking order of the the
> records will be C1, P, C2. Another transaction, T2, that attempts to
> update only C2, will lock the records in order C2, P.

> The locks on C2 and P are taken in different orders by the two
> transactions, leading to the possibility of deadlock.

But the lock on P is shared, hence no deadlock.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-02-12 05:22:48 Re: select from sequences
Previous Message Tom Lane 2007-02-12 05:08:09 Re: Ooops ... seems we need a re-release pronto