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

The Archive Base Latest Questions

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

Profiling LINQ queries and their execution plans is especially important due to the crazy

  • 0

Profiling LINQ queries and their execution plans is especially important due to the crazy SQL that can sometimes be created.

I often find that I need to track a specific query and have a hard time finding in query analyzer. I often do this on a database which has a lot of running transactions (sometimes production server) – so just opening Profiler is no good.

I’ve also found tryin to use the DataContext to trace inadequate, since it doesnt give me SQL I can actually execute myself.

My best strategy so far is to add in a ‘random’ number to my query, and filter for it in the trace.

LINQ:

where o.CompletedOrderID != '59872547981' 

Profiler filter:

'TextData' like '%59872547981' 

This works fine with a couple caveats :

  • I have to be careful to remember to remove the criteria, or pick something that wont affect the query plan too much. Yes I know leaving it in is asking for trouble.
  • As far as I can tell though, even with this approach I need to start a new trace for every LINQ query I need to track. If I go to ‘File > Properties’ for an existing trace I cannot change the filter criteria.

You cant beat running a query in your app and seeing it pop up in the Profiler without any extra effort. Was just hoping someone else had come up with a better way than this, or at least suggest a less ‘dangerous’ token to search for than a query on a column.

  • 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:45:28+00:00Added an answer on May 10, 2026 at 9:45 pm

    Messing with the where clause is maybe not the best thing to do since it can and will affect the execution plans for your queries.

    Do something funky with projection into anonymous classes instead – use a unique static column name or something that will not affect the execution plan. (That way you can leave it intact in production code in case you later need to do any profiling of production code…)

    from someobject in dc.SomeTable where someobject.xyz = 123 select new { MyObject = someobject, QueryTraceID1234132412='boo' } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 64k
  • Answers 65k
  • 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 For templates and styles that are not accessible through the… May 11, 2026 at 11:00 am
  • added an answer Frankly I think the open/closed principle is more an anachronism… May 11, 2026 at 11:00 am
  • added an answer Just listen to the onComplete event to check whenever the… May 11, 2026 at 10:59 am

Related Questions

Profiling LINQ queries and their execution plans is especially important due to the crazy
There are numerous libraries providing Linq capabilities to C# code interacting with a MySql
Through profiling I've discovered that the sprintf here takes a long time. Is there
I recently began profiling an osgi java application that I am writing using VisualVM.
How is profiling different from logging? Is it just that profiling is used for
I am profiling a Perl application with perl -d:DProf . When running dprofpp on
I've been profiling an application all day long and, having optimized a couple bits
I am profiling an application suddenly using a lot of memory, and i am
I am automating some profiling tasks and want to log heap space and generation
Do you have any tips for effective profiling using Netbeans? The profiler is quite

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.