我有以下SQL查询:甲骨文连接优化
select dres.colA,
dres.colP,
dres.ID,
dre.ID,
dre.colED,
dre.VID,
vpp.VID,
vpp.colDESC
from table1 dres
left join table2 dre on dres.ID = dre.ID
left join table3 vpp on vpp.VID = dre.VID
where dre.START_TIME >= date '2017-01-01';
你有任何建议,查询如何更好地工作(或应该)? 喜欢的东西:
...where dres.ID in (select * from table2
where VID in (select * from table3))....
对于连接优化,请确保您在连接涉及的列上有适当的索引。对于基于子查询的in子句的使用应该比连接(通常) – scaisEdge
的性能低,并且该索引应该帮助数百万行?我不这么认为......只会导致嵌套循环 – Thomas
需要行数并解释计划 – Thomas