October 25, 2012 at 2:37 am
Hi,
I have a table named ClientContext that has only the clustered index.
I have a procedure sp1 that call other two procedures: sp2 and then sp3.
The procedure sp2 inserts some data in the table and sp3 update data in the table.
CREATE PROCEDURE sp1
AS
BEGIN
EXEC sp2;
EXEC sp3
END
CREATE PROCEDURE sp2
AS
BEGIN
INSERT INTO ClientContext.....
END
CREATE PROCEDURE sp3
AS
BEGIN
UPDATE ClientContext....
END
The procedure sp1 is called from application. I have an deadlock on UPDATE in sp3 procedure.
I get the graph of deadlock with SQL Profiler (see the attachement Deadlock.png image file).
I get the locks after deadlock ocured from sys.dm_tran_locks system view (see attachement dm_tran_lock.png)
It seems from the graph that process 55 has Update (U) lock on the index and process 64 has exclusive lock (X) on the same index.
But U and X locks are incompatible locks.
How can two processes put incompatible locks on the same resource?
Could anybody explain me this?
October 25, 2012 at 3:14 am
The X and U locks are key locks, not object locks. Each one is locking a different row in the index.
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
October 26, 2012 at 6:49 am
Thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply