当前位置:网站首页>SQL Server 各种锁 NOLOCK、UPDLOCK、HOLDLOCK、READPAST
SQL Server 各种锁 NOLOCK、UPDLOCK、HOLDLOCK、READPAST
2022-07-16 20:41:00 【youandme520】
HOLDLOCK
将共享锁保留到事务完成,而不是在相应的表、行或数据页不再需要时就立即释放锁。HOLDLOCK 等同于 SERIALIZABLE。
NOLOCK
不要发出共享锁,并且不要提供排它锁。当此选项生效时,可能会读取未提交的事务或一组在读取中间回滚的页面。有可能发生脏读。仅应用于 SELECT 语句。
PAGLOCK
在通常使用单个表锁的地方采用页锁。
READCOMMITTED
用与运行在提交读隔离级别的事务相同的锁语义执行扫描。默认情况下,SQL Server 2000 在此隔离级别上操作。
READPAST
跳过锁定行。此选项导致事务跳过由其它事务锁定的行(这些行平常会显示在结果集内),而不是阻塞该事务,使其等待其它事务释放在这些行上的锁。READPAST 锁提示仅适用于运行在提交读隔离级别的事务,并且只在行级锁之后读取。仅适用于 SELECT 语句。 READUNCOMMITTED 等同于 NOLOCK。
READUNCOMMITTED
等同于 NOLOCK。
REPEATABLEREAD
用与运行在可重复读隔离级别的事务相同的锁语义执行扫描。
ROWLOCK
使用行级锁,而不使用粒度更粗的页级锁和表级锁。
SERIALIZABLE
用与运行在可串行读隔离级别的事务相同的锁语义执行扫描。等同于 HOLDLOCK。
TABLOCK
使用表锁代替粒度更细的行级锁或页级锁。在语句结束前,SQL Server 一直持有该锁。但是,如果同时指定 HOLDLOCK,那么在事务结束之前,锁将被一直持有。
TABLOCKX
使用表的排它锁。该锁可以防止其它事务读取或更新表,并在语句或事务结束前一直持有。
UPDLOCK
读取表时使用更新锁,而不使用共享锁,并将锁一直保留到语句或事务的结束。UPDLOCK 的优点是允许您读取数据(不阻塞其它事务)并在以后更新数据,同时确保自从上次读取数据后数据没有被更改。
XLOCK
使用排它锁并一直保持到由语句处理的所有数据上的事务结束时。可以使用 PAGLOCK 或 TABLOCK 指定该锁,这种情况下排它锁适用于适当级别的粒度
边栏推荐
- Tencent is all around. It's silly to ask
- Two stack implementation queue and two queue implementation stack (JS)
- 私域运营很火,私域运营是否适合所有企业?
- C语言自定义类型:结构体,枚举,联合
- LCD display tear solution
- Enter a URL and explain the whole process
- 2-conan binary package dependency management scheme
- Nature Aging | 激活FOXM1基因人类寿命或翻倍
- (板子)AcWing841. 字符串哈希
- Jiulian technology development board is officially integrated into the openharmony backbone
猜你喜欢

原装rexroth比例阀4WRBA10W64-2X/G24N9Z4/M

Can't go on, mend the foundation -- C thread develops output string program

Alicloud3 build WordPress

私域运营很火,私域运营是否适合所有企业?

Leetcode48. rotate image

第3章业务功能开发(查看市场活动明细)

Why is OS called in uCOSII_ ENTER_ Critical() or OS_ EXIT_ Critical() will make an error. The error message is: undeclared identifier `cpu_ sr‘

Source code analysis of ArrayList

leetcode--两个数组交集2

Arduino window garbled
随机推荐
leetcode--两个数组交集2
Dior is suspected of plagiarizing Chinese horse face skirt, and the product has been removed from the domestic official website
Three sides of headlines + four sides of Alibaba + five sides of Tencent took the offer to share the summary, and finally joined Alibaba
北大&微软联合提出超强时间序列表示学习框架,显著提升多项时间序列任务效果
[basic service] [database] MySQL master-slave replication deployment and configuration
Pytorch installation (very detailed)
In addition to Chang'an, these four domestic brands also use "Lexus face". Has Chinese design regressed?
The author of surging issued the pressure test results
(manual) [sqli-labs58-61] limit the injection times: error injection, get injection, character / number type
Voice conversion history research record
Common problems of database
2-conan binary package dependency management scheme
[applet project development -- JD mall] product list page of uni app (Part 1)
Web crawler technology creates its own Youdao dictionary
[deployment] redis
2022年软考网络管理员备考指南
SIEMENS模块6DD1661-0AE1
安全测试之逻辑漏洞
训练过程中出现loss为nan的问题
派克Parker比例阀D1FVE50BCVLB