Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Posting Deadlock Data


Posting Deadlock Data

Author
Message
David O
David O
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 923
I have deadlock data (trace flag stuff) and corresponding trace data. What is the best way to include that data in a post?

David
GilaMonster
GilaMonster
SSC Guru
SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)

Group: General Forum Members
Points: 53821 Visits: 44620
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

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


David O
David O
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 923
Gail

So that is what the attachment button is forBigGrinWink

Amazing what you learn when you scroll down. w00t
David O
David O
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 923
Ok, now that Gail has taught me how to post. Smile

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.
Attachments
PostDetails.txt (69 views, 7.00 KB)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)

Group: General Forum Members
Points: 53821 Visits: 44620
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

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


David O
David O
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 923
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.
Attachments
codeandschema.zip (28 views, 3.00 KB)
David O
David O
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 923
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
GilaMonster
GilaMonster
SSC Guru
SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)SSC Guru (53K reputation)

Group: General Forum Members
Points: 53821 Visits: 44620
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

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search