What is a NOLOCK?

Answers were Sorted based on User's Feedback



What is a NOLOCK?..

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

What is a NOLOCK?..

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

What is a NOLOCK?..

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

Post New Answer

More SQL Server Interview Questions

How to list all tables having unique constraints in any of the columns in a database.

1 Answers  


Do you know what are the differences between lost updates and uncommitted dependencies?

0 Answers  


How do triggers work?

0 Answers  


Explain system rowset functions?

0 Answers  


Explain different types of index?

0 Answers  






explain query execution plan

1 Answers  


What is Primary key and foreign key? Give an example

4 Answers   TCS,


i want only duplicates rows from coloumn ex. emp_id(colomn name)1,1,2,3,3,4,5,5. so i want only duplicates no.

3 Answers   iFlex,


What is database replication?

0 Answers  


explain the type of contraints

3 Answers  


Explain system functions or built-in functions? What are different types of system functions?

0 Answers  


What is table constraint?

0 Answers  


Categories