Sunday 17 August 2014

MySQL Entity Framework 6 Include Performance Woes

Just a short post today, but after some pretty exhaustive performance testing with Entity Framework 6 and MySQL .NET Connector I am pretty much in the camp that .Include(...) is only ever detrimental to performance. This is down to the really poor query generation with MySQL and Entity Framework.
I have tested so far 8 parts of our current site, all different scopes of query including single record lookups, listings for a directory and more advanced filters to query on specific parameters and in each case adding Includes has increased the query times as opposed to Entity Frameworks lazy loading strategy. This seems really foreign to me but after looking at the SQL generated it is clear why MySQL has a tough time running the queries quickly. In short, stick to Lazy Loading with MySQL until the query generation in Entity Framework improves.