Remove some auto created indices from Entity Framework?

Posted on

Question :

I’m using Microsoft’s Entity Framework. It automatically creates indices for every foreign key, but in many cases, I can see from the index stats that these are never used for reading – they are only ever updated (which doesn’t surprise me as I doubt I am ever actually doing a join on many of them). My gut feeling is that I should remove these indexes as they are just slowing down updates (albeit probably not that significantly) and taking up space. I like to try to keep things clean and lean. Is there a good reason to keep them?

Answer :

Foreign keys should be indexed as a best practice. If you’re not using them now, you can disable them or drop them, but you may want to use them later. The impact on performance is negligible in most cases if you keep them.

I’d leave them as is.

Leave a Reply

Your email address will not be published. Required fields are marked *