Re: "deadlock detected" documentation - Mailing list pgsql-sql

From Tom Lane
Subject Re: "deadlock detected" documentation
Date
Msg-id 28936.1053112428@sss.pgh.pa.us
Whole thread Raw
In response to Re: "deadlock detected" documentation  (Matt Mello <alien@spaceship.com>)
List pgsql-sql
Matt Mello <alien@spaceship.com> writes:
> The two situations I can think of are:
> 1) Two FK fields in a single row pointing to 2 different FK tables, for 
> which any 2 updates get locks in opposite order (seems like a deadlock).

I don't think this is possible, at least in 7.3.  All backends are
guaranteed to run the triggers of a given table in the same order,
so the foreign-row locks should be acquired in the same column order
in all cases.

> 2) Two FK fields pointing to only 1 FK table (both fields are references 
> to the same table), for which each update gets independent locks instead 
> of one lock for both fields, so there is a potential that #1 problem 
> could impact this as well.

Not clear what you mean by "independent locks"; there is only one row
lock on a row.

The cases that I'd be concerned about are not within-row conflicts, but
multi-row conflicts...
        regards, tom lane


pgsql-sql by date:

Previous
From: Randall Lucas
Date:
Subject: Re: Efficiency Issue with "SELECT IN (..)" and "SELECT .. OR .."
Next
From: Mike Winter
Date:
Subject: Re: Efficiency Issue with "SELECT IN (..)" and "SELECT .. OR