Using With (nolock) in SQL Server

Using WITH (NOLOCK) in sql server definitely help in improving the performance of the SQL queries, as it tells the SQL Server that ignore any lock on the table and give me whatever data is available in the tables.

So if you are updating a table, and at the same time another T-SQL is issued to query the table with nolock as hint, then it will ignore the updates and give you the data which is there in the server.

This can be harmful if you are working on some sensitive data, however if you are working on some table say

SELECT COUNT(1) FROM Table1 WITH (NOLOCK)

Then it should not matter unless a huge number of records gets deleted or inserted in the table.

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*