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 76505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:41:02+00:00 2026-05-10T20:41:02+00:00

I was doing some testing and straight LINQ-to-SQL queries run at least 80% faster

  • 0

I was doing some testing and straight LINQ-to-SQL queries run at least 80% faster than if calling stored procedures via the LINQ query

In SQL Server profiler a generic LINQ query

 var results = from m in _dataContext.Members  select m; 

took only 19 milliseconds as opposed to a stored procedure

 var results = from m in _dataContext.GetMember(userName)  select m; 

(GetMember being the stored procedure) doing the same query which took 100 milliseconds

Why is this?

Edit:

The straight LINQ looks like this in Profiler

SELECT      [t1].[MemberID], [t1].[Aspnetusername], [t1].[Aspnetpassword],      [t1].[EmailAddr], [t1].[DateCreated],      [t1].[Location], [t1].[DaimokuGoal], [t1].[PreviewImageID],        [t1].[value] AS [LastDaimoku],      [t1].[value2] AS [LastNotefied],      [t1].[value3] AS [LastActivityDate], [t1].[IsActivated] FROM      (SELECT           [t0].[MemberID], [t0].[Aspnetusername], [t0].[Aspnetpassword],           [t0].[EmailAddr], [t0].[DateCreated], [t0].[Location],           [t0].[DaimokuGoal], [t0].[PreviewImageID],           [t0].[LastDaimoku] AS [value], [t0].[LastNotefied] AS [value2],           [t0].[LastActivityDate] AS [value3], [t0].[IsActivated]      FROM           [dbo].[Members] AS [t0]) AS [t1] WHERE      [t1].[EmailAddr] = @p0 

The stored procedure is this

SELECT Members.* FROM Members  WHERE dbo.Members.EmailAddr = @Username 

So you see the stored procedure query is much simpler.. but yet its slower…. makes no sense to me.

  • 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-10T20:41:03+00:00Added an answer on May 10, 2026 at 8:41 pm

    1) Compare like with like. Perform exactly the same operation in both cases, rather than fetching all values in one case and doing a query in another.

    2) Don’t just execute the code once – do it lots of times, so the optimiser has a chance to work and to avoid one-time performance hits.

    3) Use a profiler (well, one on the .NET side and one on the SQL side) to find out where the performance is actually differing.

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

Sidebar

Related Questions

I am doing some performance testing and have found that SQL seems to be
I was doing some testing on an app, and I realized that calling .state()
I am doing some testing on a new html5-css3 framework and I want to
I'm currently doing some testing to determine the performance implications of including an index
I am doing some testing for a very large website, created many different developers.
I was just doing some random testing on locking in multi-threading this morning and
I am doing some initial testing for a Rails app which will be deployed
I'm doing some unit testing, and some of the code is checking to see
I'm in the process of doing some advance IE8 testing, and it seems that
I've just started doing some real-world performance testing on my Fluent NHibernate / SQLite

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.