x

Need help to solve a deadlock

Hi All,

I am trying to understand the reason for this deadlock and how can I avoid it. Attached is the query to create schema and run script to generate deadlock.

I am getting the deadlock on same table and on PK.

Thanks Abhishek link text

more ▼

asked Apr 18 at 06:27 PM in Default

avatar image

Abhishek
18 1 1 4

Can you post a picture of the deadlock graph?

Apr 18 at 07:22 PM JohnM

thanks for looking, I have attached the script and graph again

Apr 19 at 04:24 AM Abhishek
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

The code you've provided is a text book example of what it takes to make deadlocks. Something is going to need to "give" and you're the one that has to decide that. If it were me, I'd move the delete out of the transaction and, perhaps, setup a sweeper job to clean out the old stuff. If you write your queries to find the newer stuff, it shouldn't cause a problem.

more ▼

answered May 06 at 05:38 AM

avatar image

Jeff Moden
2.3k 3 7 13

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x64

asked: Apr 18 at 06:27 PM

Seen: 84 times

Last Updated: May 06 at 05:38 AM

Copyright 2017 Redgate Software. Privacy Policy