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 |
Why use triggers?
What is the default port for SQL Server over a firewall?
How to get a list of columns in a view using the "sp_columns" stored procedure?
How to concatenate two strings in SQL Server.
What is primary key, unique key, and foreign key?
How to create a stored procedure with a statement block in ms sql server?
Explain what is lock escalation and what is its purpose?
tell me what are the steps you will take to improve performance of a poor performing query? : Sql server database administration
what number files will a information contain in SQL Server? How many forms of information files exist in SQL Server? How many of those files can exist for a single database?
What is the difference between cube operator and rollup operator? : SQL Server Architecture
What are the advantages of user defined function?
1.how to find the dead lock in sql server? 2.How to fine the memory leaks in sql server? 3.suppose transaction log file increasing what action will take ?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)