RSS‎ > ‎

SQL :: What is a NOLOCK?

posted Aug 17, 2012, 6:41 AM by Ashish Jain
Using the NOLOCK query optimiser hint is generally considered good practice in order to improve concurrency on a busy system. When you use the NOLOCK query hint you are telling the storage engine that you want to access the data no matter if the data is locked by another process or not.  This is why is can make it appear that the query is just running faster as you are no longer waiting for other processes to complete their writes, you are simply reading what ever is in the buffer pool or on disk at the time that you get to it.  This leads to a problem called dirty reads, meaning that you may not be getting the same values that you would get it you were to run the query again.  This isn’t necessarily a bad thing, just something to be aware of.
Comments