Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 165235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:53:07+00:00 2026-05-11T11:53:07+00:00

Just read this interesting article by Omar on his blog Linq to SQL solve

  • 0

Just read this interesting article by Omar on his blog Linq to SQL solve Transaction deadlock and Query timeout problem using uncommitted reads and at the end Javed Hasan started arguing with him about his solution to the nolock situation on a high volume site.

Here, the problem trying to solve is, from the sql sense we need to use Select statements with NOLOCK or use SET TRANSACTION LEVEL READ UNCOMMITTED, otherwise at high volume rows in DB will be locked and cause errors. The technology Omar used is Linq2Sql, so the question is how do we get this achieved in your C# data access code so the above does not happen?

Basically in the post, Omar comes to his solution by working and testing on real world site and with tools like SqlProfiler, whereas Javed Hasan comes to his solution with MSDN documents and Scott Hanselman’s blog post etc.

Omar suggests using the following

using (var db = new DropthingsDataContext2()) {   db.Connection.Open();   db.ExecuteCommand('SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;');    var user = db.aspnet_Users.First();   var pages = user.Pages.ToList(); } 

whereas Javed Hasan suggests

using (new TransactionScope(TransactionScopeOption.Required,    new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) {  //Your db Operation } 

I’m very interested to know what you guys out there do on this particular issue on a high volume site like the StatckOverflow, or what did Jeff and their guys do in this regard?

Edit: After reading the first post, I want to point out a few things in Omar’s post.

  1. he did run into connection problem with his approach but he solved it, see his post.
  2. more importantly he mentioned he tried the using ADO.NET Transaction way and even tried what Scott Hanselman wrote on his blog, but it is not working for high volume site, it degrades the performance quite a bit. Omar said this ‘System.Transactions has significant overhead. I have never been able to use it on a high volume website without making CPU go 100% and Req/sec come down to 1/10th. It’s made for enterprise applications, not for high volume websites.’
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:53:08+00:00Added an answer on May 11, 2026 at 11:53 am

    First of all please avoid uncommitted reads, they can cause lots of issues. A much better approach is just to set the database to snapshot isolation. This is what Jeff did.

    Jeff basically said: ‘bla bla bla, be real, bla bla bla, database theoreticians, bla bla bla, READ UNCOMMITTED can be useful for REAL production apps that don’t need data consistency.’ Jeff is not a DBA, fortunately there are many DBAs out here on SO.

    The problem with Omar’s approach is that it can leak connections with ‘read uncommitted’ isolation level in to your connections pool which could wreak havoc in your website. Meaning random statement may be executed in read uncommitted.

    Javed approach would be much better because on dispose MS have the chance to clean stuff up on the connection.

    EDIT If you are having performance issues with Javed’s approach you could look at rolling your own transaction manager.

    Some things you probably want to do:

    • Hold a stack of current transactions
    • Confirm you are on the creator thread when a transaction is committed
    • Reset the transaction isolation to its previous state on dispose
    • Rollback on dispose if the transaction was not committed.
    • Support nested rollbacks.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 281k
  • Answers 281k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Both Animal and Mammal are classes. Animal a = new… May 13, 2026 at 3:50 pm
  • Editorial Team
    Editorial Team added an answer Are you retaining your SongTest object? You don't show that… May 13, 2026 at 3:50 pm
  • Editorial Team
    Editorial Team added an answer If I really wanted to keep the directory structure of… May 13, 2026 at 3:50 pm

Related Questions

I recently read the excellent article The Transactional Memory / Garbage Collection Analogy by
I have just read this interesting article about the implementation details for various languages
According to this http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html article, I defnitely should. Quote Gentle, yet insistent executive summary:
I've been reading this article about closures in which they say: all the plumbing

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.