I use SQL Server and have simple table:

我使用SQL Server并有简单的表:

Person (ID bigint, Name nvarchar(255))

It contains 1000 rows (for example). I'm using this SQL query:

它包含1000行(例如)。我正在使用这个SQL查询:

Update Person
Set Name = 'Jason' 
Where Id = 100

I want to understand how SQL Server will do read/write locking. Will it block one row (which I'm updating) or will it block all Person table?

我想了解SQL Server如何进行读/写锁定。它会阻塞一行(我正在更新)还是会阻止所有Person表?

Will the situation change if I will use query?

如果我使用查询,情况会改变吗?

Update Person
Set Name = 'Jason' 
Where Name = 'Piter'

1 个解决方案

#1


I suggest you to read this SQL Server Transaction Locking and Row Versioning Guide.

我建议你阅读这个SQL Server事务锁定和行版本控制指南。

In general, your query will take update lock on the row which is updated, unless server decides that it should use lock escalation and locks page or table/index.

通常,您的查询将对更新的行进行更新锁定,除非服务器决定它应使用锁升级并锁定页面或表/索引。

更多相关文章

  1. PLSQL乱码解决方案
  2. 数据库sql及索引优化
  3. 如何:在SQL Server 2005中管理多个重叠索引
  4. 根据(var2) (var3) (var3)极限X (var3)对var1(1,2,…)组的适当索
  5. 数据库不支持中文解决方案(mysql)
  6. Mysql order by语句未使用索引的思考
  7. Mysql替代解决方案Cassandra
  8. [置顶] Android屏幕适配解决方案
  9. 物流货运移动APP解决方案

随机推荐

  1. 从屏幕外动画div,没有绝对位置?
  2. JavaScript的前世今生
  3. 是否可以知道文件是否在用户的浏览器缓存
  4. 部署java后端和Javascript前端
  5. JavaScript 实现 GriwView 单列全选
  6. Javascript和AJAX,仅在使用alert()时有效
  7. 是否可以从节点js中的同一模块导出构造函
  8. 模板渲染后KnockoutJS绑定事件
  9. 使用JSLint检查Javascript,parseInt报Warn
  10. 可编辑div中的文本计数和子字符串