Re: SELECT FOR UPDATE - Mailing list pgsql-hackers

From Thomas Swan
Subject Re: SELECT FOR UPDATE
Date
Msg-id 3F208A37.7010806@idigx.com
Whole thread Raw
In response to Re: SELECT FOR UPDATE  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: SELECT FOR UPDATE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:

>Thomas Swan wrote:
>  
>
>>When a SELECT FOR UPDATE query is executed, are the row level locks on a 
>>table acquired in any specific order such as to enhance deadlock 
>>prevention? ( primary key, oid, etc. )
>>    
>>
>
>Interesting question, because in a join, you could have multiple tables
>involved.  Sorry, I don't know the answer.
>
>  
>
I had remembered several readings on ordered locking as a method to 
prevent deadlocks, and associated that with select for update 
methodology.  In theory if you aquired locks in the following order, for 
each table/relation (in oid order) get rows/tuples (in oid order), you 
could help avoid deadlock by never gaining a lock ahead of someone 
else.  Locks could be released in the same order.  The system should be 
predictable even with oid wrap arounds.

I'm quite sure that someone has done something like this for postgres 
though....

Perhaps table/row oids are a good idea?




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: SELECT FOR UPDATE
Next
From: Bruce Momjian
Date:
Subject: name of configure threading option