WEB开发网
开发学院数据库MySQL MySQL Explain详解 阅读

MySQL Explain详解

 2008-09-03 11:09:02 来源:WEB开发网   
核心提示: (2). PRIMARY我的理解是最外层的select.例如:mysql>explainselect*from(select*fromt3whereid=3952602)a;++-+++---+-+-+--+--+---+|id|select_type|table|type|poss

(2). PRIMARY

我的理解是最外层的select.例如:

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).union

union中的第二个或后面的select语句.例如

mysql>explainselect*fromt3whereid=3952602unionallselect*fromt3; 
  +----+--------------+------------+-------+-------------------+---------+---------+-------+------+-------+ 
  |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|union|t3|ALL|NULL|NULL|NULL|NULL|1000|| 
  |NULL|unionRESULT||ALL|NULL|NULL|NULL|NULL|NULL|| 
  +----+--------------+------------+-------+-------------------+---------+---------+-------+------+-------+

上一页  1 2 3 4 5 6 7  下一页

Tags:MySQL Explain 详解

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接