Search code examples
c#sqlperformancelinqentity-framework

Do Views degrade the EF query performance?


I was looking for some tips to improve my entity framework query performance and came accross this useful article.

The author of this article mentioned following:

09 Avoid using Views

Views degrade the LINQ query performance costly. These are slow in performance and impact the performance greatly. So avoid using views in LINQ to Entities.

I am just familiar with this meaning of view in the context of databases. And beacuse I don't understand this statement: Which views does he mean?


Solution

  • That's some pretty serious micro-optimisation in that article.
    I wouldn't take it as gospel personally, having worked with EF quite a bit. Sure those things can matter, but generally speaking, it's pretty quick.

    If you've got a complicated view, and then you're performing further LINQ on that view, then sure, it could probably cause some slow performace, I wouldn't bet on it though.

    The article doesn't even have any bench marks!

    If performance is a serious issue for your program, narrow down which queries are slow and post them here, see if the SO community can help optimise the query for you. Much better solution than all the micro-optimisation if you ask me.