Re: Record Locking

From: Dave Mausner <dmausner_at_brauntech.com>
Date: 1996/11/07
Message-ID: <55t8ui$d1s_006_at_news.psi.net>#1/1


In article <Pine.SUN.3.95.961106162820.19136A-100000_at_Ra.MsState.Edu>,

   "Jereme R. Chapman" <jrc2_at_Ra.MsState.Edu> wrote:
>Our SELECT FOR UPDATE seems to be locking the entire table, instead
>of the one row that the query returns.

select for update bars other selects for update of the same rows. it does not bar simple selects. if your query is against a specific row, only that row will be locked by that process. use a simple select to find a suitable row, then use select for update nowait on the same row. if the query returns an error, the row is locked, otherwise it is yours. do not use select for update on a range of rows, especially a full scan, for this will lock all the rows inspected.

Dave Mausner, Managing Consultant, Braun Technology Group, Chicago. Received on Thu Nov 07 1996 - 00:00:00 CET

Original text of this message