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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s