Description of the 'lock option' function in the SELECT statement_PHP tutorial

WBOY
Release: 2016-07-13 17:01:13
Original
954 people have browsed it

Function description of the "locking option" in the SELECT statement
SQL Server provides a powerful and complete locking mechanism to help achieve concurrency and high performance of the database system. Users can either use the default settings of SQL Server or use the "locking option" in the select statement to achieve the desired effect.
This article introduces the various "locking options" in the SELECT statement and the corresponding function descriptions.
Function description:
NOLOCK (no locking)
When this option is selected, SQL Server does not add any locks when reading or modifying data.
In this case, the user may read the data in the unfinished transaction (Uncommited Transaction) or rollback (Roll Back), which is the so-called "dirty data".
HOLDLOCK
When this option is selected, SQL Server will hold this shared lock until the end of the entire transaction without releasing it on the way.
UPDLOCK (modification lock)
When this option is selected, SQL Server uses a modification lock instead of a shared lock when reading data, and holds this lock until the end of the entire transaction or command. Using this option ensures that multiple processes can read data at the same time but only this process can modify the data.
TABLOCK (table lock)
When this option is selected, SQL Server will set a shared lock on the entire table until the command ends.
This option ensures that other processes can only read but not modify the data.
PAGLOCK (Page Lock)
This option is the default option. When selected, SQL Server uses shared page locks.
TABLOCKX (exclusive table lock)
When this option is selected, SQL Server will set an exclusive lock on the entire table until the command or transaction ends. This will prevent other processes from reading or modifying the data in the table.
Using these options will cause the system to ignore the transaction isolation level (Transaction Isolation Level) originally set in the SET statement.
Please consult the SQL Server online manual for more information.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631183.htmlTechArticle Function description of the "lock option" in the SELECT statement SQL Server provides a powerful and complete locking mechanism to help achieve Concurrency and high performance of database systems. Users can use SQL Server...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!