Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
减少 SQL Server 死锁
查找和排除 SQL Server 死锁
发生死锁时的一个非常简单的解释(当我弄错时,对不起,我不是 DBA :)):
两个事务并行运行
交易一
选择 * 从表 1 选择 * 从表 2
交易2
选择 * 从表 2 选择 * 从表 1
T1 等待 Table2,T2 等待 Table1
一种优化是以相同的顺序执行 SQL 语句。MSSQL Sever 有一个带 nolock 的选项,但是你有不一致数据的危险。