What is NOLOCK Hint in SQL Server ?

Using the NOLOCK query optimizer hint is generally considered good practice to improve concurrency on a busy system especially for Reporting workloads. When the NOLOCK hint is included in a SELECT statement, no locks are taken when data is read. The result is a Dirty Read, which means that another process could be updating the data at the exact time you are reading it. There are no guarantees that your query will retrieve the most recent data.

The performance advantage is that your reading of data will not block updates from taking place, and updates will not block your reading of data. SELECT statements generally take Shared (Read) locks which are avoided because of the hints. This means that multiple SELECT statements are allowed simultaneous access, but other processes are blocked from modifying the data.



You May Interest

What are the Limitations of Indexed Views in SQL Server ?

What are Replication and Database Mirroring in SQL Server ?

Showing Server Active Server Name in MS SQL

Getting List of All Stored Procedures in Database in MS SQL

What is CTE in SQL Server ?