一个sql服务器进程需要“range - u”锁的原因是什么

时间:2022-10-05 14:54:40

I am looking for a fix to one deadlock issue, using Entity Framework 6.1, and set READ COMMITTED SNAPSHOT ISOLATION ON for SQL Server database.

我正在寻找对一个死锁问题的修复,使用Entity Framework 6.1,并为SQL Server数据库设置读取提交快照隔离。

Below image is SQL profiler Deadlock graph, let me know if I should provide any other details which is needed to get into the issue.

下面的图片是SQL profiler死锁图,请让我知道我是否应该提供进入这个问题所需的任何其他细节。

In image below...

在下图…

CustomerOrder table is a mapping table (Customerid, OrderId), and has a composite PK (Customerid, OrderId) with unique non-clustered index

CustomerOrder表是一个映射表(Customerid、OrderId),它有一个具有唯一非聚集索引的复合PK (Customerid、OrderId)

一个sql服务器进程需要“range - u”锁的原因是什么

1 个解决方案

#1


0  

X is not a range mode. It will only cover one key, not a range. It's therefore not sufficient for whatever query you are running.

X不是范围模式。它将只覆盖一个键,而不是范围。因此,对于正在运行的任何查询,它都是不够的。

Since you're using snapshot isolation I assume your DML statements are conflicting in some ware. Range locks are common for FK checks. Hope this helps you.

由于您使用的是快照隔离,所以我假设您的DML语句在某些软件中是相互冲突的。距离锁在FK检查中很常见。希望这能帮助你。

Consider posting the conflicting statements and all other helpful information you have.

考虑发布相互冲突的声明和所有其他有用的信息。

#1


0  

X is not a range mode. It will only cover one key, not a range. It's therefore not sufficient for whatever query you are running.

X不是范围模式。它将只覆盖一个键,而不是范围。因此,对于正在运行的任何查询,它都是不够的。

Since you're using snapshot isolation I assume your DML statements are conflicting in some ware. Range locks are common for FK checks. Hope this helps you.

由于您使用的是快照隔离,所以我假设您的DML语句在某些软件中是相互冲突的。距离锁在FK检查中很常见。希望这能帮助你。

Consider posting the conflicting statements and all other helpful information you have.

考虑发布相互冲突的声明和所有其他有用的信息。