谢邀.......这个问题邀请我后我观望了好久好久(期待出现巨巨解答)
等了这么久了还没有解答,于是我就看了下8.0的manual
下面的内容节选自mysql8.0 manual,版权归属oracle8.3.6 Multiple-Column IndexesIf a multiple-column index exists on col1 and col2, the appropriate rows can be fetched directly. If separate single-column indexes exist on col1 and col2, the optimizer attempts to use the Index Merge optimization (see Section 8.2.1.3, “Index Merge Optimization”), or attempts to find the most restrictive index by deciding which index excludes more rows and using that index to fetch the rows.
If the table has a multiple-column index, any leftmost prefix of the index can be used by the optimizer to look up rows. For example, if you have a three-column index on (col1, col2, col3), you have indexed search capabilities on (col1), (col1, col2), and (col1, col2, col3).
MySQL cannot use the index to perform lookups if the columns do not form a leftmost prefix of the index. Suppose that you have the SELECT statements shown here:
这里明确指出最左匹配原则只有(1,2,3)中的(1) (1,2)(1,2,3)才能用上组合索引......
但是也应该注意到,condition的顺序是不会导致组合索引的使用的(顶多影响选择哪个组合索引),所以这里为何没用上索引.......同样迷惑ing
5.5mysql手边没有手册,无法解答