Explain
执行计划
介绍
参数说明
CREATE TABLE `father` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(50) NOT NULL COMMENT 'name',
`age` int(3) NOT NULL DEFAULT '0' COMMENT 'age',
`remark` varchar(50) DEFAULT NULL COMMENT 'remark',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_father_01` (`name`) USING BTREE,
KEY `idx_father_02` (`age`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='father';
CREATE TABLE `son` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(50) NOT NULL COMMENT 'name',
`age` int(3) NOT NULL DEFAULT '0' COMMENT 'age',
`remark` varchar(50) DEFAULT NULL COMMENT 'remark',
`father_id` int(11) DEFAULT NULL COMMENT 'father_id',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_son_01` (`name`) USING BTREE,
KEY `idx_son_02` (`age`) USING BTREE,
KEY `idx_son_03` (`father_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='son';
-- 插入几个自定义值
INSERT INTO father (name, age, remark) VALUES
('laowang', 30, '备注1'),
('laoli', 30, null);
INSERT INTO son (name, age, father_id, remark) VALUES
('xiaowang', 10, 1, '备注1'),
('dawang', 10, 1, null),
('xiaoli', 10, 2, null);
-- 插入随机值
delimiter $$
create procedure pre()
begin
declare i int;
set i=0;
while i<5000 do
INSERT INTO father (name, age, remark) values (substring(MD5(RAND()),1,5), FLOOR(RAND()*100+1), substring(MD5(RAND()),1,5));
INSERT INTO son (name, age, remark) values (substring(MD5(RAND()),1,5), FLOOR(RAND()*100+1), substring(MD5(RAND()),1,5));
set i=i+1;
end while;
end
$$
-- 还原delimiter
delimiter ;
-- 执行上述函数
call pre();
-- 删除上述函数
drop procedure pre;
字段名
含义
说明

explain_union_result 
explain_dependent_union 
explain_dependent_subquery 
explain_subquery 
explain_simple_join 
explain_derived 
explain_simple_join 
explain_uncacheable_subquery 
explain_uncacheable_union

explain_type_null 
explian_type_const 
explain_type_eq_ref 
explain_type_ref 
explain_type_fulltext 
explain_type_ref_or_null 
explain_type_index_merge 
explain_type_range 
explain_type_index 
explain_type_all 
explain_type_index1


explain_extra_null 
explain_extra_index 
explain_extra_using_temporary 
explain_extra_zero_limit
Last updated