{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/4","repository_url":"https://api.github.com/repos/aspnet/EntityFramework6","labels_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/4/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/4/events","html_url":"https://github.com/aspnet/EntityFramework6/issues/4","id":168377090,"number":4,"title":"Reverse egineering takes a few minutes on some databases using SQL Server 2016 (and probably previous versions)","user":{"login":"divega","id":1253414,"avatar_url":"https://avatars.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework6/labels/type-investigation","name":"type-investigation","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"divega","id":1253414,"avatar_url":"https://avatars.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"assignees":[{"login":"divega","id":1253414,"avatar_url":"https://avatars.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework6/milestones/1","html_url":"https://github.com/aspnet/EntityFramework6/milestones/6.2.0","labels_url":"https://api.github.com/repos/aspnet/EntityFramework6/milestones/1/labels","id":1905902,"number":1,"title":"6.2.0","description":"","creator":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":2,"state":"open","created_at":"2016-07-26T21:17:29Z","updated_at":"2016-08-15T20:06:39Z","due_on":null,"closed_at":null},"comments":13,"created_at":"2016-07-29T17:44:48Z","updated_at":"2016-08-17T16:40:13Z","closed_at":null,"body":"This was originally reported by @julielerman at https://github.com/Microsoft/sql-server-samples/issues/57 while trying the OLTP version of the new SQL Server 2016 sample databases, WorldWideImporters (https://github.com/Microsoft/sql-server-samples/releases/tag/wide-world-importers-v1.0). \r\n\r\nI have created this issue on our side to follow up with the SQL Server team.\r\n\r\n**Repro steps:**\r\n1. Create new class library project.\r\n2. Add new item: Entity Framework Data Model.\r\n3. Select connection to World Wide Importers (not DW) on SQL Server 2016 instance.\r\n4. Select all tables.\r\n5. Go (which will install EF6 package and reverse engineer tables into classes).\r\n\r\n**Observed result:**\r\nIt takes about 3 minutes. \r\n\r\n**Expected result:** \r\nIt should take about 10 seconds max.\r\n\r\n**Cause:**\r\nWhat we know so far is that this is a regression caused by differences in SQL Server 2016's cardinality estimator (CE). There have been similar issues in SQL Server 2014, which we tried to workaround by introducing `OPTION (QUERYTRACEON 9481)` on our reverse engineering queries but that didn't work for customers that didn't have enough permissions to use `QUERYTRACEON`.\r\n\r\n**Workaround:**\r\nIt should be possible to temporarily downgrade the cardinality estimator on a specific database to use previous behaviors:\r\n\r\n1. Execute `ALTER DATABASE SCOPED CONFIGURATION SET LEGACY_CARDINALITY_ESTIMATION=ON` on the database\r\n2. Perform reverse engineering using the EF Wizard\r\n3. Execute `ALTER DATABASE SCOPED CONFIGURATION SET LEGACY_CARDINALITY_ESTIMATION=OFF` on the database\r\n\r\n**Follow up actions:**\r\nWe are in contact with the SQL Server team regarding this issue and the follow up action is to work with them to see if the CE can be tweaked to eliminate the regression or if there is anything we can do on the EF side.\r\n\r\ncc @jodebrui "},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/comments/240471234","html_url":"https://github.com/aspnet/EntityFramework6/issues/4#issuecomment-240471234","issue_url":"https://api.github.com/repos/aspnet/EntityFramework6/issues/4","id":240471234,"user":{"login":"jodebrui","id":13336822,"avatar_url":"https://avatars.githubusercontent.com/u/13336822?v=3","gravatar_id":"","url":"https://api.github.com/users/jodebrui","html_url":"https://github.com/jodebrui","followers_url":"https://api.github.com/users/jodebrui/followers","following_url":"https://api.github.com/users/jodebrui/following{/other_user}","gists_url":"https://api.github.com/users/jodebrui/gists{/gist_id}","starred_url":"https://api.github.com/users/jodebrui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodebrui/subscriptions","organizations_url":"https://api.github.com/users/jodebrui/orgs","repos_url":"https://api.github.com/users/jodebrui/repos","events_url":"https://api.github.com/users/jodebrui/events{/privacy}","received_events_url":"https://api.github.com/users/jodebrui/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T16:40:12Z","updated_at":"2016-08-17T16:40:12Z","body":"I ran the following statements:\r\n\r\nUPDATE STATISTICS sys.syscolpars\r\nUPDATE STATISTICS sys.sysschobjs\r\nUPDATE STATISTICS sys.syssingleobjrefs\r\nUPDATE STATISTICS sys.sysiscols\r\nGO\r\n\r\nI incorporated them also in the source files:\r\nhttps://github.com/Microsoft/sql-server-samples/blob/master/samples/databases/wide-world-importers/wwi-database-scripts/4-wwi-configure-required-database-objects.sql\r\n\r\nSo if you recreate the DB from the latest source files, reverse engineering should perform well.\r\n\r\n\r\nThanks,\r\nJos\r\n\r\nFrom: Erik Ejlskov Jensen [mailto:notifications@github.com]\r\nSent: Tuesday, August 16, 2016 4:44 AM\r\nTo: aspnet/EntityFramework6 <EntityFramework6@noreply.github.com>\r\nCc: Jos de Bruijn <jodebrui@microsoft.com>; Mention <mention@noreply.github.com>\r\nSubject: Re: [aspnet/EntityFramework6] Reverse egineering takes a few minutes on some databases using SQL Server 2016 (and probably previous versions) (#4)\r\n\r\n\r\nTried freeproccache on my test db - no luck.\r\n\r\nRestored WWI-Std database backup - ran if 4 secs! 😄\r\n\r\n@jodebrui<https://github.com/jodebrui> : What secret \"updates\" did you do to the sample database ?\r\n\r\n—\r\nYou are receiving this because you were mentioned.\r\nReply to this email directly, view it on GitHub<https://github.com/aspnet/EntityFramework6/issues/4#issuecomment-240078458>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMuA9km8-JVwOUkq9E6uQ7LtZwvi-Netks5qgaJogaJpZM4JYanI>.\r\n"}}
{"actor":{"display_login":"jodebrui"}}