select * from t1 where x in (select x from t2)
为什么表t4的查询计划结果是DEPENDENT SUBQUERY 依赖外部查询的子查询
用extended+show warnings得到重建后的查询
select `test`.`t3`.`x` AS `x`,`test`.`t3`.`y` AS `y` from `test`.`t3` where <in_optimizer>(`test`.`t3`.`x`,<exists>(select 1 from `test`.`t4` where (<cache>(`test`.`t3`.`x`) = `test`.`t4`.`x`)))请问为什么这样优化呢, 效率很高吗??????????????????????????
为什么表t4的查询计划结果是DEPENDENT SUBQUERY 依赖外部查询的子查询
用extended+show warnings得到重建后的查询
select `test`.`t3`.`x` AS `x`,`test`.`t3`.`y` AS `y` from `test`.`t3` where <in_optimizer>(`test`.`t3`.`x`,<exists>(select 1 from `test`.`t4` where (<cache>(`test`.`t3`.`x`) = `test`.`t4`.`x`)))请问为什么这样优化呢, 效率很高吗??????????????????????????
where t1.x=t2.x;
这种句式, t2会报扫描多次, in(select..) 这种的话子查询就只需要扫描一次就行了啊这种优化是为什么呢