高并发下,sqlserver 两个独立的表为什么会产生死锁,上面截图中键锁的 Object Name 是 Table1。
Table1.Id 为主键
Table1.UserId 非聚集索引
有木有大佬指点指点,拜谢~
事务1:
(@p__linq__0 int)SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[UserId] AS [UserId],
[Extent1].[Email] AS [Email],
[Extent1].[CreateTime] AS [CreateTime],
[Extent1].[UpdateTime] AS [UpdateTime]
FROM Table1 AS [Extent1]
WHERE [Extent1].[UserId] = @p__linq__0
事务2:
(@0 bigint,@1 uniqueidentifier,@2 int,@3 int,@4 nvarchar(max) ,@5 int,@6 int,@6 decimal(38,8),@7 datetime2(7),@8 datetime2(7))INSERT Table2([Id], [TradeId], [OrderSide], [UserId], [Email], [RewardUserId], [Qty], [CreateTime], [UpdateTime])
VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8)