[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2013-06-25
1
Medium Priority
?
297 Views
Last Modified: 2013-06-25
Can I lock up data?
0
Comment
Question by:patriotpacer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
dsacker earned 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

656 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