Multiple columns in a single index versus multiple indexes

Posted by Tim Coker on Server Fault See other posts from Server Fault or by Tim Coker
Published on 2010-04-30T17:49:23Z Indexed on 2010/04/30 17:58 UTC
Read the original article Hit count: 253

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?

© Server Fault or respective owner

Related posts about database

Related posts about index