BP29: Always profile your code to verify what query is sent to a database and how efficient it is

EntityFramework (and ORM in general) is great tool and most of the time it will save you quite some time. When it comes to performance, however, you need to keep an eye on it.

Most of the time, materialized queries will be quite efficient and well formed. But sometimes they will be insanely wrong and they will have bad performance. You need to stay on top of this and be the one who will identify incorrectly formed, slow queries early during the development stage. So use SQL profilers and always check what queries you are sending to the database.

And when you have that SQL profiler running, check even the other queries that take long to execute. When you see that something takes long, check the query plan, missing indexes, multi-column index usage and oher things.

Comments

No Comments Yet.
Be the first to tell us what you think.

Download Better Coder application to your phone and get unlimited access to the collection of enterprise best practices.

Get it on Google Play