September 10, 2008 at 9:22 am
I have deadlock data (trace flag stuff) and corresponding trace data. What is the best way to include that data in a post?
David
September 10, 2008 at 9:29 am
What format's the deadlock info? If it's the text deadlock graph from the error log, just put it into a post. Otherwise zip and attach and explain what's in the zip file.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 10, 2008 at 9:54 am
Gail
So that is what the attachment button is for:D;)
Amazing what you learn when you scroll down. :w00t:
September 10, 2008 at 4:02 pm
Ok, now that Gail has taught me how to post. 🙂
The attached file shows the statement level trace for the two deadlocking spids plus the deadlock collision from the errorlog. A deadlock should be a conflict over two resources between two processes. This data shows that deadlock happened over one resource (dbo.order_detail). I would have expected this to block and resolve not deadlock.
I'm getting multiple deadlocks a day on this procedure so it isn't a freak event.
Any thoughts or suggestions would be appreciated.
September 11, 2008 at 1:10 am
What it looks like is that both processes had a shared lock (probably from a foreign key check earlier on) and then both wanted an exclusive. Neither can get the exclusive until the other releases the share... deadlock.
Can you please post the procedure and indicate while is line 106, and also post the schema and indexes of the tables involved (at minimum the table that's actually been deleted on line 106)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 11, 2008 at 10:18 am
Gail
Thanks for the insight. I hadn't thought of that at all. I think I'm guilty of over-engineer my joins in an effort to address the previous deadlock issue. The Delphi code (yes, I work in a delphi shop please don't laugh to hard) had been deadlocking on it's use of sp_executesql.
Here is the code, any additional ideas would be appreciated.
September 12, 2008 at 12:58 pm
Found it!!!
Our freight calculation (delphi code) is doing a delete-insert every time freight is re-calculated. Freight has a item_number and we have three indexes that have the item number in the lead position. Every calculation is causing the indexes to be updated and affectively creating a hot spot where the deadlocks are happening.
We are going to change the calculation to use insert-update instead. Tracing for the locks:acquired in our development environment help me get the answer.
Gail, your point on the foriegn key got me going in a new direction and help find the contention point. Thanks for the assist.
David
September 13, 2008 at 3:10 am
Excellent. Glad you came right.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply