SQL Server – Snapshot Isolation and Committed Data

deadlockisolation-levelsql serversql-server-2008-r2

So, I have some deadlocking issues.

I have seen two options to resolve it. Add read uncommitted to my db or do Snapshot Isolation and add read committed snapshot.

After doing some research into both, it seems to me that read uncommitted can allow reads of data that could possibly never get committed to the database.

On the flip side read committed snapshot will give only the latest (it is the latest right?) committed version of data (even if the data that may be in the middle of a change/transaction.)

Is this right?

If so, I am leaning towards Snapshot Isolation (I don't really want to return data that is in the middle of a change.)

However, my DBA told me that last he heard there were "problems" with Snapshot Isolation. (He did not expand on the the problems were, just that it was not a Enterprise ready feature.)

So, here are my questions on Snapshot Isolation:

Is Snapshot Isolation robust? Does it just work?

Or are there "gotchas" that I need to look out for?

Best Answer

On the flip side read committed snapshot will give only the latest committed version of data

Incorrect. Snapshot will give you the data that was committed at the moment the snapshot was taken. This moment means either when you issued BEGIN TRAN if you use true SNAPSHOT isolation level, or the moment your statement started if you use read_committed_snapshot RCSI. That means that if multiple updates commit, on the same record, you will not see the latest, but instead the one that was committed when your 'took the snapshot'. Think of it a a photo: you take a picture of the data and from then on you can only see the picture, no matter how the 'real' scenery changes behind.

Snapshot is absolutely robust. If your DBA has objections, then he/she should be able to articulate them so that they can be addresses or dismissed, as is the case. Everything has trade offs and gotchas. Indexes have trade offs and gotchas, does that mean your DBA does not use indexes?