explain的用法上说:ref 显示使用哪个列或常数与key一起从表中选择行。
这句话是在不理解。
注:这个ref不是type中的ref。
https://dev.mysql.com/doc/ref...
The ref column shows which columns or constants are compared to the index named in the key column to select rows from the table.
key 列是实际使用的 index 。 但 index 可能建立在数据表的若干列上。ref 列列出具体哪些列或常数被使用了。
4 回答1.2k 阅读✓ 已解决
8 回答1.2k 阅读
3 回答1k 阅读✓ 已解决
2 回答1.7k 阅读
1 回答845 阅读✓ 已解决
2 回答1.2k 阅读
2 回答1k 阅读
最近我也在看 explain
我认为 ref这列表示的是,表里面哪些字段走了索引(如果索引是主键或者唯一索引的话,会显示 const),最后选出了数据(选择行,一行一行的数据)