You can only catch so many errors when working with databases by looking at the code you write. It’s only when you start using your code against production data sets do you realize there’s an obvious mistake. Sure, your app may still technically work, but it’s limping along, performing inefficient queries and ultimately providing a less-than-ideal experience to your users.
I’ve recently written a blog post about Entity Framework Core Interceptors, but I thought I’d revisit the topic because I had an idea. Is there enough information given to an interceptor to warn us of poor querying decisions? In fact, there is!
In this post, you’ll see how to implement a specific type of interceptor to catch greedy queries that can be the source of potential performance issues.