0

We have a performance issue when using CTP 4 and code-only (no .edmx model file).

Is it possible to pre-generate "views" when using code-only and CTP 4?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Lars Hiim
  • 11
  • 1

1 Answers1

0

You can't. However, your question is too vague to be sure this is actually the issue.

Community
  • 1
  • 1
Craig Stuntz
  • 125,891
  • 12
  • 252
  • 273
  • Think your link answered my question. We use Entity Framework CTP 4. We generate a new Context for every request, thus NOT a static Context (due to that our queries are transferred through several processes using WCF). The ContextBuilder (containing our Configurations) and connection are static. We experience that a query returning about 70 objects, with some related objects (guess the query fetches data from about 7-8 tables), use about 2 seconds. We read that the generation of "views" is what consumes about 60% of the time used to fetch our 70 objects. Suggestions for increasing performance? – Lars Hiim Nov 05 '10 at 14:46
  • I wouldn't just accept that view generation is the problem without proof. Have you profiled? You can (1) profile the SQL and (2) try is a `CompiledQuery`. If this makes the second and all later queries faster, you've found the problem. – Craig Stuntz Nov 05 '10 at 14:49
  • We see that if we run the same query twice (or more) in the same context instance; the FIRST takes about 1.9 seconds, the second and later takes about 0.8 seconds. Does this indicate that it is the view generation that takes time? Another thing: We see from SQL profiler that the actual SQL query only takes about 0.1 second. So for the second and later queries, 0.1 second is used by the db, and 0.7 seconds is consumed by our c# code. We feel that this is rather strange as DB query execution usually are the time consuming part. – Lars Hiim Nov 05 '10 at 15:05
  • There are [lots of things which could affect this.](http://blogs.msdn.com/b/dsimmons/archive/2010/07/23/ef-query-tuning.aspx) – Craig Stuntz Nov 05 '10 at 15:23
  • Thank you for great answers. We will look into 1) pre-generated views, 2) open/close connection handling, 3) our change tracking (we use change tracking since we operate in several processes and 4) our use of eager loading (includes). – Lars Hiim Nov 05 '10 at 15:51