Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Would changing the isolation level to Snapshot for only 1 sproc help?

$
0
0

Greetings.

2008R2

So I'm trying to get up the Snapshot Isolation Level learning curve for two different systems. I'm having some deadlocks in one system, and blocking in the other. Of course code mods are the option of last resort. I've read that this isolation level can help deadlokcs, and a vendor we work with has apparently done some testing and proven that blocking has been mitigated with it as well.

I see some people have concerns about performance of this isolation level, so of course I'm a bit leary.

However, I see that most articles refer to changing the IL for the entire DB:

ALTER DATABASE myDB SET ALLOW_SNAPSHOT_ISOLATION ON; 
ALTER DATABASE myDB SET READ_COMMITTED_SNAPSHOT ON; 

However, I just did a quick test and discovered that just because I allow this isolation level, that doesnt mean I need to apply it to the entire DB. Instead I could enable it, but only apply it to the sproc I care about:

ALTER DATABASE myDB SET ALLOW_SNAPSHOT_ISOLATION ON; 
go

alter procedure mySproc
as
set transaction isolation level snapshot 
select * from foo

I'm able to successfully exec a sproc in this fashion, and have confirmed through DBCC USEROPTIONS that the other user connections are still in the old READ COMMITTED isolation level, not READ_COMMITTED_SNAPSHOT or Snapshot.

Would this help to eliminate my deadlocks and/ or blocking, while mitigating the potential performance issues I've read about?

Thanks!


TIA, ChrisRDBA





Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>