When discussing indexes, there is another question people often bring up: should we be using multiple columns in an index or multiple indexes on unique columns?
One mistake we often make is not taking the time to understand how indexing works and what we think is correct, indexing all columns used in queries separately.
In this case, you end up with a table that has multiple indexes. But these indexes end up having only one column. This kind of problem can be seen very quickly.
If you have queries with multiple columns in a WHERE clause, you will probably need multiple indexes that will contain multiple columns for optimal performance. But wait, we must keep in mind that indexing all possible combinations, thinking that you will get better performance, may very well have an opposite effect.
Let's use an example of indexes with...