简体   繁体   English

MS SqlServer中的并发事务管理

[英]Concurrent transaction management in MS SqlServer

I have a question concerning transaction isolation in SQL Server. 我有一个关于SQL Server中事务隔离的问题。 The default isolation level is set to 2 (READ_COMMITED). 默认的隔离级别设置为2(READ_COMMITED)。 In the first transaction, I insert some data in table users; 在第一个事务中,我在表用户中插入了一些数据。 in the second, I try, unsuccessfully, to select all data from the same table, it seems that the second transaction waits for the first one to commit/rollback. 在第二个事务中,我尝试从同一表中选择所有数据均未成功,似乎第二个事务正在等待第一个事务提交/回滚。

Does anyone have an explanation? 有人有解释吗?

That is exactly what the read committed means, the second transaction will wait until it is able to read all the data. 这正是读取提交的含义,第二个事务将等待,直到它能够读取所有数据。 There are ways to either read the uncommitted data or skip it, but that is not something you would normally want to do. 有几种方法可以读取未提交的数据或跳过未提交的数据,但这通常不是您想要的。

There is quite a lot of material available for this, for example this one in TechNet 有很多可用的材料,例如TechNet中的此材料

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM