MySQL Explain详解
2008-09-03 11:09:02 来源:WEB开发网(6).SUBQUERY
子查询中的第一个select.
mysql>explainselect*fromt3whereid=(selectidfromt3whereid=3952602);
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------------+
|id|select_type|table|type|possible_keys|key|key_len|ref|rows|Extra|
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------------+
|1|PRIMARY|t3|const|PRIMARY,idx_t3_id|PRIMARY|4|const|1||
|2|SUBQUERY|t3|const|PRIMARY,idx_t3_id|PRIMARY|4||1|Usingindex|
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------------+
(7). DEPENDENT SUBQUERY
子查询中的第一个select,取决于外面的查询。
mysql>explainselectidfromt3whereidin(selectidfromt3whereid=3952602);
+----+--------------------+-------+-------+-------------------+---------+---------+-------+------+--------------------------+
|id|select_type|table|type|possible_keys|key|key_len|ref|rows|Extra|
+----+--------------------+-------+-------+-------------------+---------+---------+-------+------+--------------------------+
|1|PRIMARY|t3|index|NULL|PRIMARY|4|NULL|1000|Usingwhere;Usingindex|
|2|DEPENDENTSUBQUERY|t3|const|PRIMARY,idx_t3_id|PRIMARY|4|const|1|Usingindex|
+----+--------------------+-------+-------+-------------------+---------+---------+-------+------+--------------------------+
(8).DERIVED
更多精彩
赞助商链接