我们正面临一个死锁问题,其中外键索引发生争用。 从死锁图中我看到来自特定进程的插入获取外键索引的独占(X)锁定,其中来自不同进程的选择尝试读取索引。
我不是SQL Server的专家,我无法理解这个问题。 我附加了报告死锁的服务器错误日志。
非常感谢任何帮助。
2011-03-08 12:30:22.25 spid6s Deadlock encountered .... Printing deadlock information
2011-03-08 12:30:22.25 spid6s Wait-for graph
2011-03-08 12:30:22.25 spid6s
2011-03-08 12:30:22.25 spid6s Node:1
2011-03-08 12:30:22.25 spid6s KEY: 10:72057594043039744 (3e00cedb1991) CleanCnt:3 Mode:X Flags: 0x1
2011-03-08 12:30:22.25 spid6s Wait List:
2011-03-08 12:30:22.25 spid6s Owner:0x000000009FA97A40 Mode: S Flg:0x42 Ref:1 Life:00000001 SPID:67 ECID:0 XactLockInfo: 0x00000000AC30FB90
2011-03-08 12:30:22.25 spid6s SPID: 67 ECID: 0 Statement Type: SELECT Line #: 1
2011-03-08 12:30:22.25 spid6s Input Buf: Language Event: (@p__linq__0 nvarchar(4000),@p__linq__1 datetime2(7),@p__linq__2 datetime2(7))SELECT TOP (30)
[Project1].[name] AS [name],
[Project1].[employee_name] AS [employee_name],
[Project1].[name1] AS [name1],
2011-03-08 12:30:22.25 spid6s Requested by:
2011-03-08 12:30:22.25 spid6s ResType:LockOwner Stype:'OR'Xdes:0x0000000080E27CC0 Mode: S SPID:60 BatchID:2 ECID:0 TaskProxy:(0x000000008AB44538) Value:0x86e09940 Cost:(0/0)
2011-03-08 12:30:22.25 spid6s
2011-03-08 12:30:22.25 spid6s Node:2
2011-03-08 12:30:22.25 spid6s KEY: 10:72057594043039744 (3e00cedb1991) CleanCnt:3 Mode:X Flags: 0x1
2011-03-08 12:30:22.25 spid6s Grant List 0:
2011-03-08 12:30:22.25 spid6s Owner:0x000000009C4C9700 Mode: X Flg:0x40 Ref:0 Life:02000000 SPID:84 ECID:0 XactLockInfo: 0x0000000093E879B0
2011-03-08 12:30:22.25 spid6s SPID: 84 ECID: 0 Statement Type: INSERT Line #: 1
2011-03-08 12:30:22.25 spid6s Input Buf: Language Event: (@0 nvarchar(255),@1 bigint,@2 int,@3 nvarchar(255),@4 nvarchar(255),@5 nvarchar(255))insert [dbo].[employee]([employee_request_id], [job_history_id], [employee_name], [state])
values (@0, @1, @2, @3, @4, @5)
select 09:55 09/03/2011
2011-03-08 12:30:22.25 spid6s Requested by:
2011-03-08 12:30:22.25 spid6s ResType:LockOwner Stype:'OR'Xdes:0x00000000AC30FB50 Mode: S SPID:67 BatchID:2 ECID:0 TaskProxy:(0x00000000AE7F6538) Value:0x9fa97a40 Cost:(0/0)
2011-03-08 12:30:22.25 spid6s
2011-03-08 12:30:22.25 spid6s Node:3
2011-03-08 12:30:22.25 spid6s OBJECT: 10:21575115:0 CleanCnt:2 Mode:S Flags: 0x1
2011-03-08 12:30:22.25 spid6s Grant List 0:
2011-03-08 12:30:22.25 spid6s Owner:0x00000000A0101FC0 Mode: S Flg:0x40 Ref:2 Life:00000001 SPID:67 ECID:0 XactLockInfo: 0x00000000AC30FB90
2011-03-08 12:30:22.25 spid6s Requested by:
2011-03-08 12:30:22.25 spid6s ResType:LockOwner Stype:'OR'Xdes:0x0000000093E87970 Mode: IX SPID:84 BatchID:2 ECID:0 TaskProxy:(0x0000000093C5A538) Value:0x9b54a280 Cost:(0/5820)
2011-03-08 12:30:22.25 spid6s
2011-03-08 12:30:22.25 spid6s Victim Resource Owner:
2011-03-08 12:30:22.25 spid6s ResType:LockOwner Stype:'OR'Xdes:0x0000000080E27CC0 Mode: S SPID:60 BatchID:2 ECID:0 TaskProxy:(0x000000008AB44538) Value:0x86e09940 Cost:(0/0)
2011-03-08 12:30:22.25 spid6s
2011-03-08 12:30:22.25 spid6s Victim Resource Owner:
2011-03-08 12:30:22.25 spid6s ResType:LockOwner Stype:'OR'Xdes:0x00000000AC30FB50 Mode: S SPID:67 BatchID:2 ECID:0 TaskProxy:(0x00000000AE7F6538) Value:0x9fa97a40 Cost:(0/0)
由于 Venkat