When we choose our indexes by guessing, we inevitably make some wrong choices. Misunderstandings about when to use indexes leads to mistakes in one of these three categories:
Defining no indexes or not enough indexes
Defining too many indexes or indexes that don’t help
Running queries that no index can help
We commonly read that a database incurs overhead as it keeps an index up-to-date. Each time we use INSERT, UPDATE, or DELETE, the database has to update the index data structures for that table to be consistent so that our subsequent searches use these indexes to find the right set of rows reliably.
We’re trained to think that overhead means waste. So when we read that the database ...