TheBugSlayer
Programmer
I wish I could attach an image without resorting to a link but here is the situation:
Process 180 has a U lock on Page A; Process 319 requests an IX lock on Page B and gets denied. Process 319 holds an IX lock on Page B and Process 180 requests a U lock and gets denied. A deadlock occurs.
Process 180 runs the following query:
Process 319 runs
Both processes run a query against the same table. However Process 319 is attempting an INSERT.
My question is why is Process 319 deadlocked if it's an INSERT? I based this assertion on the fact that the SQL Server Profiler's trace Deadlock Graph shows a cross on process 319. All tables in the query are properly indexed. Is it because the record that Process 319 is trying to insert will have indexes created for it that would fall in the page that Process 180 has locked?
Thanks for the help.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
Process 180 has a U lock on Page A; Process 319 requests an IX lock on Page B and gets denied. Process 319 holds an IX lock on Page B and Process 180 requests a U lock and gets denied. A deadlock occurs.
Process 180 runs the following query:
Code:
UPDATE TableA
SET Main=c.Main, Sub=c.Sub, Grp=c.Grp
FROM TableA a
JOIN TableC c ON a.FacilityID=c.FacilityID AND a.ClientID=c.ClientID
WHERE a.Main IS NULL AND c.Main IS NOT NULL
Code:
INSERT INTO [TableA]([ClientID],[FacilityID],[PatientID],[AccNumber],[ReportDateTime],[DeliveryStatus],[PDFLocation],
[OriginalPDFName],[CollectionDate],[ReceivedDate],[Pathologist],[FacilityKey])
VALUES(@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12)
Both processes run a query against the same table. However Process 319 is attempting an INSERT.
My question is why is Process 319 deadlocked if it's an INSERT? I based this assertion on the fact that the SQL Server Profiler's trace Deadlock Graph shows a cross on process 319. All tables in the query are properly indexed. Is it because the record that Process 319 is trying to insert will have indexes created for it that would fall in the page that Process 180 has locked?
Thanks for the help.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)