Re: How do you prevent Deadlocks

From: Don Vick <dvick_at_lanier.com>
Date: Fri, 2 Dec 1994 17:11:12 GMT
Message-ID: <D0712p.Lrw_at_lanier.com>


In article <cj10.34.000CDA6F_at_ucs.cam.ac.uk>, C.J.Jardine <cj10_at_ucs.cam.ac.uk> wrote:
>In article <D056Av.331_at_lanier.com> dvick_at_lanier.com (Don Vick) writes:
>
>>> [description of deadlock problem solved by indexes on parents]
 

>>I was about to suggest a more extreme solution, but this has the ring of
>>truth. Transactions cannot deadlock if their executions do not overlap,
>>and indexing the foreign keys will greatly speed up insertion of child
>>records or deleting of parents, thus reducing the incidence of overlap.
>
>This is not the point. See pages 6-9 and 6-10 of the Application Developer's
>Guide. If there isn't an index, insertion into a child table requires
>a lock on the WHOLE parent table. It there is an index to locks are needed
>on the parent table.
>
Indeed, the manual says this, and it explains the deadlocks, but I can't quite see WHY the lock is needed. Doesn't Oracle just need to check for the existence of a parent record? Isn't row-level locking enough to allow this? What am I missing here?



Donald E. Vick (dvick_at_lanier.com, dvick_at_crl.com) Voice: (404) 493-2194 Fax: (404) 493-2399 Received on Fri Dec 02 1994 - 18:11:12 CET

Original text of this message