Re: Transaction Deadlocks your thoughts?
From: Wayne Snyder (wayne.nospam.snyder_at_mariner-usa.com)
Date: 09/07/04
- Next message: Wayne Snyder: "Re: Is this really the best execution plan SQL2K can find?"
- Previous message: Erland Sommarskog: "Re: Yukon Beta Program"
- In reply to: Anubis: "Transaction Deadlocks your thoughts?"
- Next in thread: Anubis: "Re: Transaction Deadlocks your thoughts?"
- Reply: Anubis: "Re: Transaction Deadlocks your thoughts?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 7 Sep 2004 08:35:21 -0400
The rules for minimizing deadlocks are
1. Keep your transactions short - the longer the tran, the longer you hold
locks, the more likely it is that you will bump into someone in this bad
way.
2. Lock all resources in the same order, Maybe use tables alphabetically and
rows within tables in key order... The order doesn't matter as long as all
of the code does this. It is not possible to follow this all the time, but
to the extent possible - do it.
3. On the front end ( not in the SQL back end ) if you get a deadlock error
(1205) wait a little while and re-try the transaction, sheilding the error
from your end user.
4. You may look at the sp_getapplock procedures in SQL. These would allow
you to "soft lock" any resource you need prior to going into transaction
state, but all code would need to use it..
-- Wayne Snyder, MCDBA, SQL Server MVP Mariner, Charlotte, NC www.mariner-usa.com (Please respond only to the newsgroups.) I support the Professional Association of SQL Server (PASS) and it's community of SQL Server professionals. www.sqlpass.org "Anubis" <anubis@bluestreem.com.au> wrote in message news:uQLLTDNlEHA.3824@TK2MSFTNGP12.phx.gbl... > Hello All, > > > I was interested to see peoples opinions and fixes? > > I'm currently working on a site which 99% consists of Stored Procedures and > on the old site which this one will be replacing is basically recordsets > with update commands. > > The old site is currently producing a large number of transaction deadlocks, > I'm hoping that with a database restructure and changing to stored > procedures this may help to correct the problem? > > Any thoughts on this issue would be great! > > Thanks > Anubis > >
- Next message: Wayne Snyder: "Re: Is this really the best execution plan SQL2K can find?"
- Previous message: Erland Sommarskog: "Re: Yukon Beta Program"
- In reply to: Anubis: "Transaction Deadlocks your thoughts?"
- Next in thread: Anubis: "Re: Transaction Deadlocks your thoughts?"
- Reply: Anubis: "Re: Transaction Deadlocks your thoughts?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|