Bug #59994 Entity Framework .edmx file takes hours to update from database
Submitted: 7 Feb 2011 19:56 Modified: 20 Jun 2011 14:23
Reporter: Robert Hood Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.3.6 OS:Windows ( Win7)
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: entity framework, regression, update from

[7 Feb 2011 19:56] Robert Hood
Description:
Updating the Entity Data Model from the MySQL database takes over 2 1/2 - 7 hours to complete.  I've tracked this down to the query the entity framework generates to query the server for the structure.  My database has 212 tables in it with various foreign keys between them.  Database servers are mysql 5.0.77 & 5.0.45

How to repeat:
Generate a database with over 200 tables in it.  Open Visual Studio 2008 or 2010.  Create a Entity Data Model and go home for the night.  Model might be done by morning.

Suggested fix:
I have downloaded the source for 6.3.6 and currently cannot figure out a suggested fix.  Previous versions around 6.2.3 did not have this same issue, but that was in VS2008.
[8 Feb 2011 8:59] Valeriy Kravchuk
Do you have the exact query generated? I'd like to check how it works standalone, from mysql command line client.
[8 Feb 2011 11:53] Robert Hood
ok I've attached the sql that is generated.  It takes forever outside of VS as well.  Also notice the where clause at the bottom.  If you take out the Where clause, the query doesn't perform half bad.  Also, the where clause grows relative to the number of tables that are excluded from the edmx.  The more the where clause grows, the slower the query becomes.
[26 May 2011 18:12] Reggie Burnett
This is a duplicate of a very old bug #48791 which has now been fixed.
[26 May 2011 18:18] Robert Hood
I am confused by your comment.  Are you saying that you made no code changes because this issue has been addressed in the past? Or are you saying that the fix has been reapplied in the 6.3 code line?  We are using 6.3.6 now and the bug is very much existing in 6.3.6
[26 May 2011 18:30] Reggie Burnett
Sorry for the not-so-clear comment.  The fix for the bug was just pushed to our internal repos and will appear in 6.3.7 (and the updates to 6.1 and 6.2).  In our testing we used a 200 table db with foreign keys and was able to reproduce the delay of many hours.  After the fix, that same db imports using the wizard in < 1 minute.
[20 Jun 2011 14:23] Robert Hood
Is there a target for the release of the Connector that includes this fix?  This bug is really killing us at this point.
[28 Sep 2015 14:07] Ivan Ferrer
having the same issue today using VS2013 and Connector/NET 6.9.4, solved it by moving other databases out from the \data folder. I had one DB with 3000 tables, and many other smaller.
Now it takes ~10 seconds to create/update tables in Entity Designer (EF6) (before it was like 3 minutes).