1.联合主键索引 PARIMARY KEY( col1,col2) 多列索引KEY(col1,col2)
where条件查询时不区分顺序 where col1 = xxx and col2 = xxx 等于 where col2 = xxx and col1 = xxx 查询优化器会处理 并使用索引
最左匹配原则, where col1 = xxx 使用索引 where col2 = xxx 无法使用索引
1.联合主键索引 PARIMARY KEY( col1,col2) 多列索引KEY(col1,col2)
where条件查询时不区分顺序 where col1 = xxx and col2 = xxx 等于 where col2 = xxx and col1 = xxx 查询优化器会处理 并使用索引
最左匹配原则, where col1 = xxx 使用索引 where col2 = xxx 无法使用索引