深入MySQL--MySQL执行计划初探
本帖最后由 lee 于 2020-6-29 20:43 编辑执行计划收集
DAO_OBJECTS t1 , DAO_OBJECTS t2WHERE deptno= t1.object_idANDt1.object_name=t2.object_name ;+----+-------------+-------+------+---------------+------+---------+------+-------+----------------------------------------------------+| id | select_type | table | type | possible_keys | key| key_len | ref| rows| Extra |+----+-------------+-------+------+---------------+------+---------+------+-------+----------------------------------------------------+|1 | SIMPLE | t1 | ALL| NULL | NULL | NULL | NULL | 49793 | NULL ||1 | SIMPLE | EMP | ALL| FK_DEPTNO | NULL | NULL | NULL | 14 | Using where; Using join buffer (Block Nested Loop) ||1 | SIMPLE | t2 | ALL| NULL | NULL | NULL | NULL | 49793 | Using where; Using join buffer (Block Nested Loop) |+----+-------------+-------+------+---------------+------+---------+------+-------+----------------------------------------------------+
执行计划列详解
ID
ID列表明了该语句所在的层级 如果ID相同从上到下执行 如果ID不同则ID越大的越先执行 其作用类似于Oracle执行计划中缩进
mysql> explain SELECT * FROM EMP , DAO_OBJECTS1 t1 , DAO_OBJECTS2 t2WHERE deptno= t1.object_idANDt1.object_name=t2.object_name ;+----+-------------+-------+------+---------------+------+---------+------+-------+----------------------------------------------------+| id | select_type | table | type | possible_keys | key| key_len | ref| rows| Extra |+----+-------------+-------+------+---------------+------+---------+------+-------+----------------------------------------------------+|1 | SIMPLE | t1 | ALL| NULL | NULL | NULL | NULL | 49793 | NULL ||1 | SIMPLE | EMP | ALL| FK_DEPTNO | NULL | NULL | NULL | 14 | Using where; Using join buffer (Block Nested Loop) ||1 | SIMPLE | t2 | ALL| NULL | NULL | NULL | NULL | 49793 | Using where; Using join buffer (Block Nested Loop) |+----+-------------+-------+------+---------------+------+---------+------+-------+----------------------------------------------------+
[*]语义等价查询
**** Hidden Message *****
66666666666
页:
[1]