mysql> explain select tc.ControlledPCMAC,tc.ControlledPCNickName,tb.CSK300SN,tb.Client_ID from T_BindCSK300 tb left join T_ControlledPC tc on tb.CSK300SN = tc.CSK300SN where tb.Client_ID='6099888bdfe7465098674070d2abd8ff';
+----+-------------+-------+------+-------------------------+-------------------------+---------+---------------------------+-------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+-------------------------+-------------------------+---------+---------------------------+-------+--------------------------+
| 1 | SIMPLE | tb | ref | index_clientid_csk300sn | index_clientid_csk300sn | 153 | const | 1 | Using where; Using index |
| 1 | SIMPLE | tc | ref | index_csk300sn_1 | index_csk300sn_1 | 153 | GoToMyCloudDB.tb.CSK300SN | 18215 | |
+----+-------------+-------+------+-------------------------+-------------------------+---------+---------------------------+-------+--------------------------+
2 rows in setmysql> explain select tc.ControlledPCMAC,tc.ControlledPCNickName,tb.CSK300SN,tb.Client_ID from T_BindCSK300 tb left join T_ControlledPC tc on tb.CSK300SN = tc.CSK300SN where tb.Client_ID='6099888bdfe7465098674070d2abd8ff';
+----+-------------+-------+------+-------------------------+-------------------------+---------+---------------------------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+-------------------------+-------------------------+---------+---------------------------+------+--------------------------+
| 1 | SIMPLE | tb | ref | index_clientid_csk300sn | index_clientid_csk300sn | 153 | const | 1 | Using where; Using index |
| 1 | SIMPLE | tc | ref | index_csk300sn | index_csk300sn | 153 | GoToMyCloudDB.tb.CSK300SN | 478 | |
+----+-------------+-------+------+-------------------------+-------------------------+---------+---------------------------+------+--------------------------+这里有个问题,我只是对表T_ControlledPC的列(CSK300SN)添加了一个单列索引,开始索引名称为index_csk300sn_1,通过explain查看rows是18215,但是我把索引名称改为index_csk300sn后,rows却变成478,如果我在改,仍会变,并且rows的值也不确定,一法知道这是什么原因
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货