I am trying to optimize my database now using Database Engine Tuning Advisor, and the problem I am facing is that my SQL Profiler trace shows tons of queries performed using sp_executesql – and the advisor fails to process those. It seems like these queries come from LINQ-to-Entities I am using, so just curious if there is any way to make LINQ-to-Entities invoke statements directly.
I am trying to optimize my database now using Database Engine Tuning Advisor ,
Share
Agree with Adam. Use of
sp_executesqlin entity framework/ADO.net is intentional. The queries are then executed similar to parameterized stored proc and SQL optimizer can reuse the query plan.If you are looking to tune your DB, you should consider these queries as well. I suggest you,take a backup of your DB, capture the queries using replay trace template (in your SQL profiler) , restore your DB, run your tuning advisor settings its workload to this trace