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

  • SEARCH
  • Home
  • 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 81675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:29:50+00:00 2026-05-10T21:29:50+00:00

Strange performance outcome, I have a LINQ to SQL query which uses several let

  • 0

Strange performance outcome, I have a LINQ to SQL query which uses several let statements to get various info it looks like this

    public IQueryable<SystemNews> GetSystemNews() {     using (var t = new TransactionScope(TransactionScopeOption.Required,               new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))     {         var results = from s in _datacontext.SystemNews                       let member = GetMemberInfo(s.MemberID)                       let determination = GetDetermination(s.DeterminationID.Value)                       let daimoku = GetDaimoku(s.DaimokuID.Value)                       let entry = GetEntry(s.EntryID.Value)                       let encouragment = GetEncouragement(s.EncouragementID.Value)                       select new SystemNews                       {                           NewsDate = s.NewsDate,                           MemberID = s.MemberID,                           PhotoID = s.PhotoID.Value,                           DeterminationID = s.DeterminationID.Value,                           DaimokuID = s.DaimokuID.Value,                           EntryID = s.EntryID.Value,                           EncouragementID = s.EncouragementID.Value,                           Member = new LazyList<Members>(member),                           Determination = new LazyList<Determinations>(determination),                           Daimoku = new LazyList<MemberDaimoku>(daimoku),                           Entry = new LazyList<MemberEntries>(entry),                           Encouragement = new LazyList<MemberEncouragements>(encouragment),                           IsDeterminationComplete = s.IsDeterminationComplete.Value                       };         return results;     } } 

I created the same thing (basically at least the various info that is obtained in this) into a SQL View, and the LINQ to SQL returned results in under 90 miliseconds where as the view returned the same data actually less info in over 700 milliseconds. Can anyone explain this?

  • 1 1 Answer
  • 0 Views
  • 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-10T21:29:50+00:00Added an answer on May 10, 2026 at 9:29 pm

    In general, LINQ-to-SQL will be ‘about the same’, and I’d agree that caching is porbably an issue here. Really you need to look at the generated SQL; the easiest way being:

    _datacontext.Log = Console.Out; 

    Then try running the TSQL directly in Query Analyzer. SPROCs have some advantages in terms of being able to optimise access, use table variables, etc; however, LINQ has the advantage of composability – i.e. you can apply your paging, sorting, projections, etc in the single query. You can at a push do that with an SPROC, but it is very hard work.

    But really, the key is in looking at the TSQL; it might be that you haven’t loaded all the data, for example (lazy loading).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange situation on a production server. Connection for asp.net get queued
I am using SQL Server 2005 and I have noticed something strange when I
I have a very strange problem. Under some elusive circumstances I fail to apply
Hi I experience a strange phenomena. I have a Java application that queries DB
I'm dealing with a strange problem. I have a GUI built using swing. Its
I'm currently experiencing a strange issue that my understanding of SQL server doesn't quite
Strange question, but: Sharepoint 2007 greets you with the Administrator Tasks on the Central
Strange program hang, what does this mean in debug? After attaching windbg I found
A strange thing happened after a supplier changed the XML header a bit. I
a strange behavior happens when install the application and then run the exe file.

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.