Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xingshaocheng authored Sep 16, 2018
1 parent 13aba7b commit ac91a86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ MyISAM 是非聚集,InnoDB 是聚集
* [《复合索引的优点和注意事项》](https://www.cnblogs.com/summer0space/p/7247778.html)
* 文中有一处错误:
> 对于复合索引,在查询使用时,最好将条件顺序按找索引的顺序,这样效率最高; select * from table1 where col1=A AND col2=B AND col3=D 如果使用 where col2=B AND col1=A 或者 where col2=B 将不会使用索引
原文中提到索引是按照“col1,col2,col3”的顺序创建的,而mysql在按照最左前缀的索引匹配原则,且会自动优化 where 条件的顺序,当条件中只有 col2=B AND col1=A 时,会自动转化为 col1=A AND col2=B,所以依然会使用索引。
* 原文中提到索引是按照“col1,col2,col3”的顺序创建的,而mysql在按照最左前缀的索引匹配原则,且会自动优化 where 条件的顺序,当条件中只有 col2=B AND col1=A 时,会自动转化为 col1=A AND col2=B,所以依然会使用索引。

* [《MySQL查询where条件的顺序对查询效率的影响》](https://www.cnblogs.com/acode/p/7489258.html)

Expand Down

0 comments on commit ac91a86

Please sign in to comment.