Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 best way to prevent deadlocks

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2008-05-29 : 20:38:22

I'm going thru my application log, and just seeing what errors are popping up. I have a relatively intense search feature, thats causing alot of deadlocks.

Exception type: SqlException
Exception message: Transaction (Process ID 105) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

In general, what's the best way to resolve this ?

Should I see if I can apply "WITH (NOLOCK)" to my data ?

Any suggestions are greatly appreciated !


thanks again!
mike123

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-05-29 : 22:09:39
Usually you can track deadlock with -T 1222 trace flag and you will
see information about deadlock in error logs .
The best way is to have right index,access data in same order, donot put higher isolation level.
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-05-29 : 23:54:49
just brush your hair every day and you'll be fine.




elsasoft.org
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2008-05-30 : 17:15:47
jezamine,

That's a dreadful joke...

=======================================
We should try to be the parents of our future rather than the offspring of our past. -Miguel de Unamuno
Go to Top of Page

mdubey
Posting Yak Master

133 Posts

Posted - 2008-06-02 : 11:47:18
To avoid deadlock read this article.

http://support.microsoft.com/kb/169960

Manoj
MCP, MCTS
Go to Top of Page
   

- Advertisement -