select查询的序列号,表示查询中执行select子句或操作表的顺序。
id相同时,执行顺序由上至下。
id不同,如果是子查询,id的序号会递增,id值越大优先级越高,则先被执行。
id相同和不同都存在时,id相同的可以理解为一组,从上往下顺序执行,所有组中,id值越大,优先级越高越先执行。
#id相同时,执行顺序是从上往下
explain select * from t1,t2,t3 where t1.id=t2.id and t2.id = t3.id;
#id不同时
explain select t1.id from t1 where t1.id in
(select t2.id from t2 where t2.id in
(select t3.id from t3 where t3.id = 1)
);
#id相同和id不同
explain select t2.* from t2,(select * from t3) s3 where s3.id = t2.id;
-- select_type
#simple 简单的select查询
explain select * from t1;
#derived primary
explain select * from (select t1.content from t1) s1;
#subquery
explain select t2.* from t2 where t2.id = (select t3.id from t3);