Don’t hog the db records


It has been a long time since I have put anything in here.  And, of course, my first entry in months is about… you guessed it… SQL.

This one is just a reminder to me to use the following code in queries to prevent the query from holding a lock on the table (I still don’t understand why a SELECT would hold a lock on a table – seems dumb to me).

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

Using the above is preferrable to using WITH (NOLOCK). See this blog entry and this one.

Leave a comment