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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:43:29+00:00 2026-06-11T18:43:29+00:00

We have a system that does all kinds of complex and simple select queries.

  • 0

We have a system that does all kinds of complex and simple select queries.

We did some simple testing and got these results:

Query 3.9 seconds :
var result = (from temp in context.model
               where temp.ID == 1302
               select temp).First();

Start Transaction time: 17:54:58.7073806
End Transaction time: 17:55:02.6246046

Query 3.7 seconds :
Model modelResult = context.Model.Find(1302);

Start Transaction time: 17:53:51.1995194
End Transaction time: 17:53:54.8737295

I have been reading trying to figure out what the best options are. There is a lot of conversation of this topic on this site, however, I have not found exactly what I need.

I know that query choices are situational (based off the complexity of the query, etc) but in the case when we need a single entity based off a key that will not be used again (meaning, in the case of Find, caching doesn’t matter because that query is very unlikely to be called again) is it better to use direct LINQ or continue to use Find?

Is the cost of caching the results of Find, when it won’t be used, too costly? Are the results of our simple test accurate enough to assume Find will always be faster in a single entity/key situation?

I didn’t test the LINQ with turning off tracing, would this be a better approach than the two examples given?

  • 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. Editorial Team
    Editorial Team
    2026-06-11T18:43:30+00:00Added an answer on June 11, 2026 at 6:43 pm

    The two are not exactly the same.

    Find will check to see if the entity has already been loaded in the context. If it has, it will just return it without performing a query. In this scenario, it will likely be far more efficient.

    However, if the entity is not in the context, it performs a query more like SingleOrDefault rather than first, which will require pulling the top two results back from the server. While there is no overhead on constructing the query, the query itself will potentially be (very slightly) slower due to that, and the results will differ, as you’ll receive errors if there is more than a single match.

    For more details and information, including the generated queries, see this Slauma’s answer here.

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

Sidebar

Related Questions

We have a system that has some Bash scripts running besides Java code. Since
I have a vb.net 2.0 winforms project that is full of all kinds of
We're currently building a system that abstracts all kinds of technical details about web
We have system here that uses Java JNI to call a function in a
I have a system that takes dynamic data, puts it in HTML for layout
I have big system that make my system crash hard. When I boot up,
I have a system that runs like this: main.exe runs sub.exe runs sub2.exe and
I have a system that will generate messages sporadically, and I would like to
We have a system that runs in IIS. The system should always run using
I have a system that has many components interacting with each other. It occured

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.