两视图用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索引