Description of the "lock options" function in the SELECT statement _ MySQL
Source: Internet
Author: User
The "lock options" function in SELECT statements shows that SQLServer provides a powerful and complete locking mechanism to help achieve database system concurrency and high performance. You can use the default settings of SQLServer or use the "lock option" in the select statement to achieve the expected results. This article introduces the "lock options" in the SELECT statement and the corresponding functions of the "lock options" in the SELECT statement.
SQL Server provides a powerful and complete locking mechanism to help achieve database system concurrency and high performance. You can use the default settings of SQL Server or the "lock option" in the select statement to achieve the expected results. This article describes the "lock options" in the SELECT statement and related functions.
Function description:
NOLOCK (no lock)
When this option is selected, SQL Server does not apply any lock when reading or modifying data. In this case, the user may read the data in the Uncommitted Transaction or Roll Back, that is, the so-called "dirty data ".
HOLDLOCK)
When this option is selected, SQL Server will keep the shared lock until the end of the entire transaction, instead of releasing it on the way.
UPDLOCK)
When this option is selected, SQL Server uses the modification lock to replace the shared lock when reading data, and keeps the lock until the entire transaction or command ends. This option ensures that multiple processes can read data at the same time, but only the process can modify data.
TABLOCK)
When this option is selected, SQL Server sets a shared lock on the entire table until the command ends. This option ensures that other processes can only read but cannot modify data.
PAGLOCK)
This option is the default option. when selected, SQL Server uses the share page lock.
TABLOCKX (exclusive table Lock)
When this option is selected, SQL Server will lock the entire table until the command or transaction ends. This prevents other processes from reading or modifying table data.
Using these options, the system will ignore the Transaction Isolation Level (Transaction Isolation Level) originally SET in the SET statement ). Please refer to the SQL Server online manual for more information.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service