The role of with(nolock) in SqlServer

To improve the query performance of SQL, generally speaking, everyone will consider building an index first. In fact, in addition to the establishment of the index, when we execute the SQL command, adding a WITH (NOLOCK) to the grammar can improve the phenomenon that the data set is LOCKed in the environment of a large number of online queries, thereby improving the performance of the query.
Advantages:
1. The SQL query efficiency of WITH (NOLOCK) can be increased by 33%.
2. It can be used in inner join statements.
Disadvantages: 1. Dirty
reads will occur
2. Only applicable to select query statements.
Modify, at this time another user just read the modified record, and then, the first user gave up the modification, and the data returned to before the modification, the two different results are dirty reads.

Guess you like

Origin blog.csdn.net/qq_37131111/article/details/122982862