When we will use the NOLOCK in SQL, Please clear my doubts?
Hai Friends, When we will use the NOLOCK in SQL, Please clear my doubts...
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Gohil JayendrasinhRank #490 · 5K reputationPosted Mar 15, 2012, 4:37 AM EDT
NOLOCK indicates that no shared locks are issued against the table so your SQL statement Return faster. If you're running a SQL statement for, say, a report, and you know it's going to take a long time
to run and be reading lots of records, you can use NOLOCK to speed it up.
locking is a good thing. Databases do it automatically so that your data doesn't become corrupted. So don't
use NOLOCK to do any writing of data, or even for quick reads. But if you've got a long-running query which needs to read a large number of records, you won't hurt anything by reading without a lock.
check Accepted Asnwers if it's helpful to you
Dorababu MekaRank #457 · 5.5K reputationPosted Mar 15, 2012, 4:21 AM EDT
It's worth considering for any queries used for reports, especially if the query takes more than, say, 1 second.
It's especially useful if you have OLAP-type reports you're running against an OLTP database.
Manikandan Chandran34 reputationPosted Mar 15, 2012, 4:53 AM EDT