by Andrei Hetel
5. September 2008 09:36
There are lots of discussions on the net about this SQL Server table hint WITH NOLOCK (or WITH READUNCOMMITTED). What it does? By using NOLOCK, SQL Server ignores locks system, and read data directly from the tables - which improve query performance. But this performance increase comes with its price: the data you read is DIRTY! As a consequence you should never ever use this data in another transaction processing.
Some DBA's are saying that the use of NOLOCK denotes a bad database design and I agree with this. Of course this hint gets into discussion only if we are dealing with tables containing millions of records, for small tables is out of discussion.
My translation of NOLOCK is:
Just give me the data, I don’t care if I have duplicated or missing rows, I don’t care if the data I read is correct or not – just give it to me!