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 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

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • 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
  • added an answer Either put the assembly in the GAC, or deploy that… May 11, 2026 at 12:32 pm
  • added an answer The CSS 2.1 standard gives examples where list-style is applied… May 11, 2026 at 12:32 pm
  • added an answer This is a pretty standard design question, and there isn't… May 11, 2026 at 12:32 pm

Related Questions

I was working with quality yesterday doing some formal testing. In their procedure they
I usually type my map declarations but was doing some maint and found one
I'm at a client doing some quick fixes to their access application. It was
I was doing the tutorial from the book teach yourself django in 24 hours
I'm currently doing some GUI testing on a ASP.net 2.0 application. The RDBMS is
I've been doing some performance testing around the use of System.Diagnostics.Debug, and it seems
I'm working on a project that uses MSTest for unit testing and I need

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.