Wednesday, May 27, 2015

SQL Server Isolation Level

I haven't figured out why this happened yet (and I may not ever), but I wanted to put it up here so that I remember that it did happen.

We had a stored procedure that was used to populate a report.  Our report server was sporadically throwing out a timeout error when the report was retrieved so one of the SQL Server developers modified the isolation level to read uncommitted data, like this:
   1:  SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

A few weeks later we encountered a problem which, after a bunch of digging and trial and error, turned out to be caused by that change.  Apparently, reading uncommitted data caused the stored procedure to also ignore the clustered index on the table from which it was reading.

I'm guessing this is documented somewhere, but since I spend most of my time on the front-end and middle-tier I'm not sure I'll ever devote the time to figuring this one out.  To fix our problem we just added another field to the order by clause to get the data we wanted.

No comments:

Post a Comment