sql - 读取SQL死锁图

标签 sql sql-server-2008 sql-server-profiler database-deadlocks

有人可以帮我阅读/理解这个死锁图吗?

我不明白为什么进程 75 请求锁定他已经锁定的对象?

Deadlock graph

最佳答案

根据一篇博客文章,我发现“交换事件”的存在表明问题的根源可能是查询中的并行性。

Today's Annoyingly-Unwieldy Term: "Intra-Query Parallel Thread Deadlocks"

上面的文章更详细,但要点是:

Workaround #1: Add an index or improve the query to eliminate the need for parallelism. In most cases, the use of parallelism in a query indicates that you have a very large scan, sort, or join that isn't supported by proper indexes. If you tune the query, you will often find that you end up with a much quicker and more efficient plan that doesn't use parallelism, and therefore isn't subject to this type of problem. Of course, in some queries (DSS/OLAP-type queries, in particular) it may be difficult to eliminate all large scans.

Workaround #2: Force single-threaded execution with an "OPTION (MAXDOP 1)" query hint at the end of the query. If you can't modify the query, you can apply the hint to any query with a plan guide.

您可能想尝试一下,看看是否有任何改进。

关于sql - 读取SQL死锁图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7267942/

相关文章:

sql-server - "exec sp_reset_connection"在 Sql Server Profiler 中意味着什么?

sql - 您可以从函数返回的表中挑选一个列值吗?

sql - 条件 where 子句 SQL Server 2012

java - 检查数据库中存在的大量字符串的有效方法

sql-server - SQL Server 2008 Management Studio - 运行参数化查询

SQL-'08 : Are multiple Replace statements a bad practice/is there another way to write this query?

具有大量 JOIN 条件的 SQL 查询非常慢

sql - Redshift : count distinct customers over window partition

sql-server - SQL Server Profiler - 列含义

SQL Profiler 不显示插入/删除/更新