作者:沈杰
链接:https://www.zhihu.com/question/36996520/answer/93256153
来源:知乎
CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `cid` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `name_cid_INX` (`name`,`cid`), KEY `name_INX` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8
执行1:
EXPLAIN SELECT * FROM student WHERE name='小红';
执行2:
EXPLAIN SELECT * FROM student WHERE cid=1;
EXPLAIN SELECT * FROM student WHERE cid=1 AND name='小红';
作者:沈杰
链接:https://www.zhihu.com/question/36996520/answer/93256153
来源:知乎