Multi-Column indexes
Hello forum,
this has been bothering me for a while and I just cant seem to get a definitive answer.
Let's assume I have a table like this:
Col_A
Col_B
Col_C
Col_D
INDEX(Col_A,Col_B,Col_C,Col_D)
Now this obviously works great if columns A,B,C,D or A,B,C or A,B OR A are used in the where clause.
But what happens if I have to omit say column C because what I want to achieve would be "give me the rows where A=x, B=y, and D=z, regardless of the value of C".
Do I need a second index like INDEX(Col_A,Col_B,Col_D) or is mysql smart enough to figure it out?
Thanks in advance for your help.
/edit
fixed thread title. oops.
Edited 1 time(s). Last edit at 10/09/2011 10:55AM by Michael Preiss.