在具有默认配置的 SQL Server 2005 中,read_committed 隔离级别和 read_committed 快照关闭。查询会因为死锁而中止吗?如果是这样,为什么?
如果我将隔离级别提高到可重复读取会怎样?
根据 msdn 文件,任何级别的隔离都可能出现这种情况:
Transaction T_1 acquires a share lock on row 1.
Transaction T_2 acquires a share lock on row 2.
Transaction T_1 now requests an exclusive lock on row 2 ( because it wants to change it), and is blocked until transaction T_2 finishes and releases the share lock it has on row 2.
Transaction T_2 now requests an exclusive lock on row 1 ( because it wants to change it), and is blocked until transaction T_1 finishes and releases the share lock it has on row 1.