September 2, 2011 at 3:26 am
I have a stored procedure which does a select to return data for a report. The sp has set transaction isolation level read uncommitted but it's blocking a load of other processes. Any ideas why?
Cheers
September 2, 2011 at 3:35 am
Read uncommitted doesn't mean No locks at all. It means no shared locks taken by reads. It still takes update and exclusive locks, it still takes schema locks.
To answer your question you're going to have to look at what the blocking resource is, what locks are held and what locks are requested.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 2, 2011 at 3:41 am
The sp only does a select, no updates, inserts, deletes or schema modifications. Would you still expect a lock?
Thanks
September 2, 2011 at 5:45 am
Every single query takes a schema lock to ensure that the schema doesn't change while it's running.
Other than that, my previous statement holds, not much more can be said without some info on what locks are held and requested.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 2, 2011 at 8:58 am
Just understand, it's a common misconception, but putting in READ UNCOMITTED or NOLOCK is not a "run faster" switch for SQL Server. It can increase some performance in some areas, but it can result in duplicate or missing rows. So you need to know what you're doing with these things before you use them.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
September 2, 2011 at 9:00 am
Duplicate or missing rows is not a concern in this instance but blocking other processes is.
Many thanks
September 2, 2011 at 9:02 am
Considered snapshot isolation?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 2, 2011 at 9:03 am
GilaMonster (9/2/2011)
Considered snapshot isolation?
+1
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
September 2, 2011 at 9:07 am
I have not seen blocking caused by a select when doing uncommitted reads unless the other stored procs are doing something with the Schema like Gail mentioned. You can still see heavy waits even if you are using uncommitted reads.
Just my 2 cents.
-Roy
September 2, 2011 at 9:09 am
I think I need to do some more investigation to see what locks are being held.
Thanks everyone for your help. I may be back!
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply