patternsqlModerate
Is the ADO.NET Entity Framework known for generating poorly performing queries?
Viewed 0 times
performingthepoorlyadogeneratingnetknownforqueriesframework
Problem
This question is inspired by the comment posted to the latest ServerFault blog post:
Are you guys still using LINQ to SQL?
I know I can use SQL Server Profiler and/or the
Are Entity Framework queries a common cause of performance problems?
Can LINQ queries be optimized in such cases or is raw Transact-SQL the only solution?
Are you guys still using LINQ to SQL?
I know I can use SQL Server Profiler and/or the
ToTraceString method to see the generated queries and analyze them myself. However, I am looking for opinions from people with hands-on experience with administering databases accessed by applications utilizing the Entity Framework.Are Entity Framework queries a common cause of performance problems?
Can LINQ queries be optimized in such cases or is raw Transact-SQL the only solution?
Solution
It depends on what the queries are. ORMs are usually really good at CRUD, as they are usually simple. The more complex the query, the greater the chance of a bad query. You can tweak the generated queries by tweaking the LINQ statements. Sooner or later though, you'll get tired of fighting and use SQL queries or stored procedures for anything that is complex.
Context
StackExchange Database Administrators Q#1245, answer score: 10
Revisions (0)
No revisions yet.