现有a,b,c字段,三个上面都建有索引,现有
1,select * from table where a=...
2, select * from table where b=...and c=...
3, select * from table where b=...and a =...
请问哪个SQL使用了索引??请高手解答一下,最好详细说明一下原因。谢谢。

解决方案 »

  1.   

    三个上面都建有索引怎么理解?有三个索引?index a, index b, index c? 还是有一个索引index (a,b,c) ?
      

  2.   

    1.index a, index b,index c  这种情况下,哪个使用了索引?
    2 index(a,b,c) 这种情况下,哪个使用了索引?
      

  3.   

    1.index a, index b,index c  这种情况下,哪个使用了索引?MySQL会根据这三个索引的“势”来选择用哪个索引,比如b索引的“势”最小,说明b中的不同值比较多,就会选用索引b.其余的两个索引则不会用到。
      

  4.   

    2 index(a,b,c) 这种情况下,哪个使用了索引?这种情况下只有  select * from table where a=... 用到了这个索引。