Is there a difference between calling the 'where' function in the beginning of the query and in the end in terms of performance?

asp.net-core c# entity-framework-core

Accepted Answer

ZZZ_tmp
1
9/23/2019 12:43:32 PM

Popular Answer

There are two levels to the performance of a LINQ-to-entities query, as was mentioned in the comments.

The first thing is what SQL generates. I would assume they would be the same in your circumstance. Only by having EF output the resultant SQL will you be certain.

The identical execution plan may still be created via SQL even if the produced SQL is different. When it comes to query optimization, SQL server is very intelligent and magical. The likelihood of both queries having the same execution plan and thus the same performance is high.

However, if efficiency is truly important to you, you should examine both the produced SQL query and the way SQL executes it. The execution plan should ideally be on a complete, index-enabled instance.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow