tags:

views:

29

answers:

1

Does anyone have a good analogy of SQLServer transaction isolation levels? (SQL2005 upward)

+2  A: 

The best analogy I've been able to use is Source Code control and building apps. A check out is a lock and a build is a transaction.

I've not written this down before, so the following is just a brief summary of the concept I use. Like any analogy, it will fall apart if you stretch it too far.

Read Committed - the code is checked out (locked) and you cannot build the code (transaction) until the code is checked in.

Read Uncommitted - you can see the code, but you do not know if it is the old version or the updated version. A build may work or may not work depending on if all of the code has been checked in yet.

Repeatable Read - files cannot be checked out while a build is in progress, but files can be added to the project if they do not affect the build.

Serializable - files cannot be checked out or added while the build is in progress; the entire project is in use/checked out (range lock).

Snapshot - the user works with the files labeled as a release, but does not see changes for the next release.

Darryl Peterson