Multiple columns in a single index versus multiple indexes
- by Tim Coker
The short version of my question is what's the difference between three indexes each indexing a single column and one index indexing three columns. Background follows.
I'm primarily a programmer but have to do DBA work because we don't have a DBA. I'm evaluating our indexes versus the queries run against a particular table. The table as 3 columns that I'm often filtering against or getting the max value of. Most of the time the queries look like
select max(col_a) from table where col_b = 'avalue'
or
select col_c from table where col_b = 'avalue' and col_a = 'anothervalue'
All columns are independently indexed. My question is would I see any difference if I had an index that indexed col_b and col_a together since they can appear in a where clause together?