Wednesday, June 13, 2012

Visualizing SQL Server Transaction Isolations (If a picture is worth a thousand words, what is a good animated Gif worth?)

Michael J. Swart - Visualizing Transaction Isolations For SQL Server

The four standard SQL Server isolation levels that SQL Server provides are READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ and SERIALIZABLE. (I leave aside the row-versioning levels for another day). SQL Server implements these isolation levels using locks.

In fact I was listening to Kimberly Tripp’s MCM Preparation Video “Snapshot Isolation“. She gives a recap of isolation levels and describes the locks taken during an index scan using READ COMMITTED. She says:

“(For readers) READ COMMITTED uses shared locks … the shared locks are only held for the life of the resource being read. You can almost think of shared locks kind of trickling through the table but not being kept.”

She invites us to visualize this scenario and so I did, literally. Enjoy!

image

..."

I thought this a cute, yet useful, visualization. That and it's good to see animated Gif's put to actually good use.

 

Related Past Post XRef:
Knowing what your doing with NOLOCK...
SQL Server Concurrency Series from the CAT (Customer Advisory Team)
LINQ to SQL NOLOCK'ing

1 comment:

  1. I know! Animated gifs are so cheesy so often. And a small step up from blink-text. This one is decent.

    The process to build it from scratch was fun though.

    Cheers,

    ReplyDelete

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...