|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, June 19, 2012 6:06 AM
Points: 33,
Visits: 177
|
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 6:55 AM
Points: 4,222,
Visits: 3,884
|
|
Very good article.
Markus Bohse
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, June 07, 2010 11:42 PM
Points: 314,
Visits: 6
|
|
Just a quick one - don't forget that SQL Server isn't the only source of deadlocks. I recently helped out on an issue where a single-threaded application DLL on one thread was blocked by a SQL Server lock, but at the same time, access to the application DLL from the locking process was also blocked. No deadlock victim, just timed-out queries and a lot of pain to the system's users.
Classic deadlock... but only one of the locks was within SQL Server. 1204 is great, but troubleshooting SQL Server deadlocks is simple compared with tracking down the problem I was helping to diagnose.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, September 07, 2012 12:30 PM
Points: 37,
Visits: 136
|
|
| Nice how-to article. But I wonder why Microsoft does not provide better support for deadlock situations. Hunting SQL server deadlocks is still like in the stone age days of programming ( in the above article even with non-documented features). Assumed SQL Server "knows" the reason, why not simply tell it?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, July 15, 2011 1:21 PM
Points: 1,181,
Visits: 24
|
|
| ;) Nice article, thanks for sharing!
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, August 07, 2012 9:00 PM
Points: 5,
Visits: 143
|
|
Great article on investigating the deadlock. Just a note that if you're running SQL 2005/2008, the trace flag 1222 (http://msdn.microsoft.com/en-us/library/ms178104.aspx) provides a lot more information so you don't have to do quite a much undocumented digging (though I found it very interesting).
Instead of the trace flag, I'd personally recommend setting up WMI to log the deadlock info: http://technet.microsoft.com/en-us/library/ms186385(SQL.90).aspx.
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Monday, June 03, 2013 7:03 PM
Points: 1,696,
Visits: 1,746
|
|
sureshot (2/3/2009) Great article on investigating the deadlock. Just a note that if you're running SQL 2005/2008, the trace flag 1222 (http://msdn.microsoft.com/en-us/library/ms178104.aspx) provides a lot more information so you don't have to do quite a much undocumented digging (though I found it very interesting).
Instead of the trace flag, I'd personally recommend setting up WMI to log the deadlock info: http://technet.microsoft.com/en-us/library/ms186385(SQL.90).aspx.
The WMI alerts can actually be a bit more resource intensive and problemattic to setup. There are a number of more moving parts involved with the WMI alerts where as the Trace Flags or a SQL Trace has minimal configuration required. In the end, if you use Trace Flag 1222 in SQL Server 2005/2008, the deadlock graph is the same from WMI, SQL Trace, Profiler, and the Trace Flags.
SQL 2008 offers Extended Events, watch for an upcoming article that I have already submitted which capture deadlock information natively while your server is running. Watch out though, the deadlock information changed to a new format in SQL 2008 that is only output by Extended Events and only Extended Events can capture and display a multi-victim deadlock, which is why there was a change made to the deadlock graph formatting in 2008 from Extended Events.
As I mentioned yesterday, deadlocks aren't necessarily the problem. If your app is coded correctly it can handled the error raised and rerun the statement and it will most likely succeed on the second attempt.
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008 My Blog | Twitter | MVP Profile Training | Consulting | Become a SQLskills Insider Troubleshooting SQL Server: A Guide for Accidental DBAs
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, January 28, 2011 12:21 PM
Points: 14,
Visits: 33
|
|
SQL 101 - Always make sure your tables have indexes to avoid full table scans.
Looks as though the DBA and/or developers need a little coaching.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, August 07, 2012 9:00 PM
Points: 5,
Visits: 143
|
|
Very interesting news about SQL 2008 and Extended Events. I'm looking forward to when we can upgrade our production servers to that.
For now the WMI deadlock system has provided a nice and easy to read history of deadlocks for us and we've hooked in an e-mail notification as well. CPU usage for WMI is roughly 2-3% on our box and we have capacity to spare so it's been worth it.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 7:07 AM
Points: 146,
Visits: 421
|
|
SQL 2005 has xml deadlock report in profiler which will track deadlock down to tables and stored procedure statements
I think your solution does not solve the deadlock - just makes it less likely
If the db+app had been designed correctly the omission of the index would have reduced performance but not created deadlocks
|
|
|
|