What does the SQL Server NOLOCK hint do?

  • It is an explicit command, which directly specify for particular table or a view.
  • It is similar to Nolock hint. It does not use locks against table’s data, once the command is issued.
  • The NOLOCK hint allows SQL to read data from tables by ignoring any locks and therefore not get blocked by other processes.
  • With the help of the NOLOCK table hint, we can read locked objects (row, page or table) which are locked by open transactions. 
  • The NOLOCK hint overrides the default behavior of the SQL Server query optimizer so that the select statement can read the locked objects.
  • This can improve query performance by removing the blocks, but introduces the possibility of dirty reads.
  • The benefit of using With Nolock is that, no deadlock is encountered against the table’s queries running against the table; also, there is no need to hold the locks against the data, which will save the memory space.
  • While using WITH (nolock) there is no need to do anything with subqueries. However, you can use it with single or subqueries. The Readuncommited and WITH (nolock) are similar as transaction isolation level. But, using WITH (nolock) could be unsafe, because it will return inconsistent result