Most of us will probably agree that using database indexes is good. Too many indexes and performance can actually be degraded.
As a general rule, which fields should be indexed?
Which fields should not be indexed?
What are the rules for using indexes while striking a balance between too many and not enough indexes in order achieve performance improvements, not degradation?
Best Answer
Short
The "too many indexes" rule is a bit misleading I think.
Long
Given that the average database is around 98% reads (or higher) reads need to be optimised. An INSERT is a read if there is a unique index, for example. Or the WHERE on an update. I once read that even a write intensive database is still 85% reads.
What you do have is poor quality indexing. Examples:
cold, cole
andcold, cole, colf)
Note it's quite typical to have indexes several times bigger than your actual data even in OLTP systems.
Generally, I'd start with the
Then I'd look at:
Saying that, I have broken these rules for some systems after seeing how things panned out (10 billion rows later) to tune a system. But I'd never consider not indexing unless I could demonstrate why I'm doing so.