两视图用union all后不走索引,但是用select再包一层查询又走索引原因?
测试(不走索引):
select * from v_gisotermjump where atermtype =86 and aconnectorid = 3814606
union all
select * from v_gisotermjump where ztermtype =86 and zconnectorid = 3814606;
测试(走索引):
select * from (
select * from v_gisotermjump where atermtype =86 and aconnectorid = 3814606
union all
select * from v_gisotermjump where ztermtype =86 and zconnectorid = 3814606);
一上脚本结果查看执行计划得出。请教高手给出原因,谢谢!unin索引
测试(不走索引):
select * from v_gisotermjump where atermtype =86 and aconnectorid = 3814606
union all
select * from v_gisotermjump where ztermtype =86 and zconnectorid = 3814606;
测试(走索引):
select * from (
select * from v_gisotermjump where atermtype =86 and aconnectorid = 3814606
union all
select * from v_gisotermjump where ztermtype =86 and zconnectorid = 3814606);
一上脚本结果查看执行计划得出。请教高手给出原因,谢谢!unin索引
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货