例如,索引是 (column1,column2) . 假设我们运行一个查询 select * from some_table where column2 > 3 and column1<2 ,mysql是否足够聪明,可以将查询重新排序为 select * from some_table where column1<2 and column2 > 3 然后使用索引 (第1栏,第2栏) ?
(column1,column2)
select * from some_table where column2 > 3 and column1<2
select * from some_table where column1<2 and column2 > 3
(第1栏,第2栏)