Query Failure with Read Uncommitted

Over the past month or so, I’ve looked at pretty much every isolation level except for read uncommitted or nolock.  Today I’m going to wrap up this series of posts with a discussion of read uncommitted.  Plenty has already been written about the dangers of nolock.  For example, see these excellent posts by Lubor Kollar…

8

Read Committed and Bookmark Lookup

In my last two posts, I discussed two scenarios – one involving updates and another involving large objects – where SQL Server extends the duration of read committed locks until the end of a statement instead of releasing the locks as soon as each row is released.   In this post – which I promise will…

1

Read Committed and Large Objects

In my last post, I explained that SQL Server holds read committed locks until the end of an update statement (instead of releasing the locks as soon as each row is released) if there is a blocking operator between the scan or seek of the rows to be updated and the update itself.  In this…

2

Read Committed and Updates

Let’s try an experiment.  Begin by creating the following simple schema: create table t1 (a int, b int)create clustered index t1a on t1(a)insert t1 values (1, 1)insert t1 values (2, 2)insert t1 values (3, 3) create table t2 (a int)insert t2 values (9) In session 1, lock the third row of table t1: begin tranupdate…

10

Serializable vs. Snapshot Isolation Level

Both the serializable and snapshot isolation levels provide a read consistent view of the database to all transactions.  In either of these isolation levels, a transaction can only read data that has been committed.  Moreover, a transaction can read the same data multiple times without ever observing any concurrent transactions making changes to this data. …

22

Repeatable Read Isolation Level

In my last two posts, I showed how queries running at read committed isolation level may generate unexpected results in the presence of concurrent updates.  Many but not all of these results can be avoided by running at repeatable read isolation level.  In this post, I’ll explore how concurrent updates may affect queries running at…

24

Query Plans and Read Committed Isolation Level

Last week I looked at how concurrent updates may cause a scan running at read committed isolation level to return the same row multiple times or to miss a row entirely.  This week I’m going to take a look at how concurrent updates may affect slightly more complex query plans. Nested Loops Join Let’s begin…

1

Read Committed Isolation Level

SQL Server 2000 supports four different isolation levels: read uncommitted (or nolock), read committed, repeatable read, and serializable.  SQL Server 2005 adds two new isolation levels: read committed snapshot and snapshot.  These isolation levels determine what locks SQL Server takes when accessing data and, therefore, by extension they determine the level of concurrency and consistency…

17