Re: How do you prevent Deadlocks

From: Steve A. Olson <solson_at_access1.digex.net>
Date: 8 Nov 1994 06:55:17 GMT
Message-ID: <39n7cl$gqm_at_news1.digex.net>


djharr_at_ccmail.monsanto.com wrote:

: We have an on-line application that is seeing significant
: deadlocks. The DBA team does know how to capture, find and
: detect when a deadlock occurs. However, the question being
: posted here is how does one correct and prevent deadlocks
: without going to some extreme measure of single-threading users
: through the application.
[Edited...]

The most straight forward way to avoid deadlocking is to always process tables in the same order. That way, whichever session gets to the first table wins and the other sessions wait there (at the first) instead of locking other rows that may be required by the first session.

One stradegy for this uses a table ranking to govern the order of access of each table. The lower the rank the earlier the table is accessed.

Also, when updating data within a single table always lock rows from the table in the same order. For example, when processing names, always access them in alphabetic order.

: Thank you for your feedback!!!
Your welcome

: David Harrier
: Monsanto Agricultural Group
: djharr_at_ccmail.monsanto.com

Steve A. Olson
Applied Information Technologies, Inc.
Steve.Olson_at_ait.cst.com
410-917-4171 Received on Tue Nov 08 1994 - 07:55:17 CET

Original text of this message