What is a NOLOCK?
Answers were Sorted based on User's Feedback
Answer / michael
Advantage:
applying nolock in select statement will increase
concurreny and performance in fetching.
Disadvantage:
it does'nt consider the transaction scenario, even if the
transaction is under process not yet commited or rollback
it will fetch the current record
eg
begin tran
insert into tablename
values('1','asdf')
select * from tablename with (nolock)
-- it will display the table with inserted record.
but the transaction is not completed, it can be rollback
so it became dirty read.
Is This Answer Correct ? | 28 Yes | 2 No |
Answer / naren
Using NOLOCK politely asks SQL Server to ignore locks and
read directly from the tables. This means you completely
circumvent the lock system, which is a major performance
and scalability improvement. However, you also completely
circumvent the lock system, which means your code is living
dangerously. You might read the not-necessarily-valid
uncommitted modifications of a running transaction. This is
a calculated risk.
Is This Answer Correct ? | 19 Yes | 1 No |
Answer / guest
Do not issue shared locks and do not honor exclusive locks.
When this option is in effect, it is possible to read an
uncommitted transaction or a set of pages that are rolled
back in the middle of a read. Dirty reads are possible. Only
applies to the SELECT statement.
Is This Answer Correct ? | 16 Yes | 3 No |
How to run queries with sql server management studio express?
What are the restrictions that views have to follow?
What are the main control-of-flow T-SQL constructs?
Which are new data types introduced in sql server 2008?
What is a transaction and what are ACID properties?
14 Answers Config Systems, IBM, TCS, Virtusa,
Explain in brief about Microsoft SQL server?
How you can minimize the deadlock situation?
What is database black box testing?
How to search for a string in all stored procedure in sql server?
Do you know what are the properties of the relational tables?
Is it possible to delete duplicate rows in a table without using a temporary table ?
What are the tool windows in sql server management studio? : sql server management studio