November 9, 2010 at 2:18 pm
friends,
please give me some idea what this nolock is exactly and why do we need to use this in our select statement...
Thanks in advance.
November 9, 2010 at 2:42 pm
NOLOCK hints are to do non-serialized reads (dirty reads) on data. It ignores all internal locking mechanisms of SQL Server and grabs the data it wants on each table that's been hinted.
It's used as a performance gain for queries in rarely modified data system, or when the accuracy of each individual row isn't critical.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
November 9, 2010 at 2:47 pm
It basically says, "I don't care if the data is being used somewhere else, and might be updated or deleted, give it to me anyway".
The use is when speed matters more than accuracy. If it's perfectly okay to give the user (customer or employee or manager) wrong data, and it has to be fast, then NoLock is okay. If wrong data matters (it almost always does), and a microscopic bit slower is fine, then don't use it.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 9, 2010 at 2:55 pm
thanks a lot guys...
now I understood what exactly nolock is....
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply