Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have observed an interesting behavior. There is a one complex query 'A' generated by Entity framework (I know this via logging) and there is another query 'B' the same query re - written via simple joins by DBA.

Now when we run 'A' and 'B' in SSMS then following is the execution time taken by each query.
A -> 1 min and 20 sec
B -> 21 sec

Now when I execute these query via a .net application using entity frame work.
A -> 25 sec
B -> 1 min

I am unable to understand why the change in the execution time. can any one shed some light on this.

I expected the same behavior when I ran the queries with .Net application and SSMS.

What I have tried:

I have tried searching online.Normally every where they have mentioned the reverse scenario. Slow in App fast in ssms. But for Query B it is reversed
Posted
Updated 29-May-17 5:46am

1 solution

Your question is unanswerable for set of reasons, but two of them are most important:
1. we can not reproduce your issue,
2. we don't see your queries (EF and SQL)
3. we have no idea what these queries do.

At this moment i suggest to use, for example LinqPad, which can "convert" an EF query into its SQL form and vice versa. There you'll be able to compare time of execution.
 
Share this answer
 
Comments
Saurabh.abhyankar 30-May-17 1:20am    
Ok thanks will look into it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900