Solved

If I don't use Nolock on a select statement...

Posted on 2013-06-25
1
280 Views
Last Modified: 2013-06-25
Can I lock up data?
0
Comment
Question by:patriotpacer
1 Comment
 
LVL 20

Accepted Solution

by:
dsacker earned 500 total points
ID: 39276151
Potentially, yes. Within a pristine design, usually no.

For instance, if you have a query without the NOLOCK that does lengthy table scans, against fields that are not indexed, etc., you could lock the table. If others are trying to update that table, they could be in a wait state until your query finishes.

If you have good indexing, and tailor your queries accordingly, even though some deadlocking may still occur, the query is usually very quick and will use indexing efficiently. Very little deadlocking will occur.

In general, WITH (NOLOCK) will prevent locking the table, if you don't mind having the potential of "dirty" reads. I know programming shops where it is still an offense subject to termination if queries do not include the WITH (NOLOCK).
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now