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

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The problem here is that the object you are getting… May 11, 2026 at 5:04 pm
  • Editorial Team
    Editorial Team added an answer RunWorkerAsync does its thread-synchronization magic by getting the SynchronizationContext from… May 11, 2026 at 5:04 pm
  • Editorial Team
    Editorial Team added an answer Are you linking tables? In my experience 99% of the… May 11, 2026 at 5:04 pm

Related Questions

I recently upgraded one of my applications to Rails 2.2.2. Having done that, I've
I have a strange phenomenon while continuously instantiating a com-wrapper and then letting the
When doing a simple performance measurement, I was astonished to see that calling String.IndexOf(char)
I am using NHibernate as my ORM solution and have a need for a

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.