locked
EF Performance issue with Include() RRS feed

  • Question

  • The topic of the performance issue of Include() has been discussed in this forum before in thread like this. That discussion is little old and I have not seen discussing after.

    Has the problem of Include() gone away in the latest version of EF4.1? In my experience it is not. I'm dealing with few tables having less than 100K records and the query has a four level deep object graph and has a GroupBy projection. The GroupBy requires the deep object graph from the tables to calculate a sum operation that needed. The performance is very slow. If I do this in the stored procedure, it is very faster.

    1. To solve the problem, I can have a stored procedure which can do the groupby. I can get the data by executing the stored proc via EF and move the data to a DTO. Is that the right approach?

    2. My second issue is about paging. With stored procedure I have better control of bringing in a paged data (25 records of 100K records). Is this kind of paging mechanism available in EF via Linq queries?

    Friday, June 8, 2012 12:00 PM

Answers

  • Hi salescrusade,

    Welcome to MSDN Forum.

    1. Executing stored procedure directly in EF is a good and common way, so if the version of EF is 4.1, please continue to use this solution. In EF5, the performance has a greate improved, please refer to this article.

    2. Yes, we often page data by 'Take' and 'Skip' in Linq. Here's a good article about how to page data in Linq, please refer here.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Allen_MSDN Monday, June 18, 2012 2:41 AM
    Monday, June 11, 2012 3:03 AM

All replies

  • Hi salescrusade,

    Welcome to MSDN Forum.

    1. Executing stored procedure directly in EF is a good and common way, so if the version of EF is 4.1, please continue to use this solution. In EF5, the performance has a greate improved, please refer to this article.

    2. Yes, we often page data by 'Take' and 'Skip' in Linq. Here's a good article about how to page data in Linq, please refer here.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Allen_MSDN Monday, June 18, 2012 2:41 AM
    Monday, June 11, 2012 3:03 AM
  • Thank you.

    Monday, June 18, 2012 11:47 AM