sql-server – 解释SQL Server锁

前端之家收集整理的这篇文章主要介绍了sql-server – 解释SQL Server锁前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
以下是sql Server 2000旨在支持的锁的列表.对于“意图”锁实际上意味着什么,我有点困惑.我在网路上环顾四周,答案似乎有点神秘.

为了得到我的具体问题的答案,我希望使用这个问题作为一个维基,每个锁是什么意思,以及在什么情况下将获得这种类型的锁.

>共享(S)

>更新(U)
>独家(X)
意图

意图共享(IS)
意图排除(IX)
>与意图专有共享(SIX)
意图更新(IU)
>更新意图独占(UIX)
>共享意图更新(SIU)

>模式

模式修改(Sch-M)
模式稳定性(Sch-S)

>批量更新(BU)
>关键范围

>共享密钥范围和共享资源锁(RangeS_S)
>共享密钥范围和更新资源锁(RangeS_U)
>插入键范围和空资源锁(RangeI_N)
>独占键范围和独占资源锁(RangeX_X)
>转换锁(RangeI_S,RangeI_U,RangeI_X,RangeX_S,RangeX_U)

解决方法

SQL server MSDN page有一个合理的解释:

An intent lock indicates that sql Server wants to acquire a shared (S) lock or exclusive (X) lock on some of the resources lower down in the hierarchy. For example,a shared intent lock placed at the table level means that a transaction intends on placing shared (S) locks on pages or rows within that table. Setting an intent lock at the table level prevents another transaction from subsequently acquiring an exclusive (X) lock on the table containing that page. Intent locks improve performance because sql Server examines intent locks only at the table level to determine if a transaction can safely acquire a lock on that table. This removes the requirement to examine every row or page lock on the table to determine if a transaction can lock the entire table.

猜你在找的MsSQL相关文章