MySQL Explain详解
2008-09-03 11:09:02 来源:WEB开发网派生表的select(FROM子句的子查询)
mysql>explainselect*from(select*fromt3whereid=3952602)a;
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
|id|select_type|table|type|possible_keys|key|key_len|ref|rows|Extra|
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
|1|PRIMARY||system|NULL|NULL|NULL|NULL|1||
|2|DERIVED|t3|const|PRIMARY,idx_t3_id|PRIMARY|4||1||
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
3.table
显示这一行的数据是关于哪张表的.
有时不是真实的表名字,看到的是derivedx(x是个数字,我的理解是第几步执行的结果)
mysql>explainselect*from(select*from(select*fromt3whereid=3952602)a)b;
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
|id|select_type|table|type|possible_keys|key|key_len|ref|rows|Extra|
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
|1|PRIMARY||system|NULL|NULL|NULL|NULL|1||
|2|DERIVED||system|NULL|NULL|NULL|NULL|1||
|3|DERIVED|t3|const|PRIMARY,idx_t3_id|PRIMARY|4||1||
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
更多精彩
赞助商链接