Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Posting Deadlock Data Expand / Collapse
Author
Message
Posted Wednesday, September 10, 2008 9:22 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, April 12, 2014 6:32 AM
Points: 172, Visits: 787
I have deadlock data (trace flag stuff) and corresponding trace data. What is the best way to include that data in a post?

David
Post #567028
Posted Wednesday, September 10, 2008 9:29 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 41,530, Visits: 34,446
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 2008, MVP
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

Post #567040
Posted Wednesday, September 10, 2008 9:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, April 12, 2014 6:32 AM
Points: 172, Visits: 787
Gail

So that is what the attachment button is for:D;)

Amazing what you learn when you scroll down.
Post #567068
Posted Wednesday, September 10, 2008 4:02 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, April 12, 2014 6:32 AM
Points: 172, Visits: 787
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.


  Post Attachments 
PostDetails.txt (51 views, 7.37 KB)
Post #567347
Posted Thursday, September 11, 2008 1:10 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 41,530, Visits: 34,446
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 2008, MVP
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

Post #567508
Posted Thursday, September 11, 2008 10:18 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, April 12, 2014 6:32 AM
Points: 172, Visits: 787
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.



  Post Attachments 
codeandschema.zip (20 views, 3.62 KB)
Post #567910
Posted Friday, September 12, 2008 12:58 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, April 12, 2014 6:32 AM
Points: 172, Visits: 787
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
Post #568871
Posted Saturday, September 13, 2008 3:10 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 41,530, Visits: 34,446
Excellent. Glad you came right.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
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

Post #569021
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse