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...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gohil JayendrasinhPosted Mar 15, 2012, 8:37 AM
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
Manikandan ChandranPosted Mar 15, 2012, 8:53 AM
Dorababu MekaPosted Mar 15, 2012, 8:21 AM
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.