现在我碰到这样一个问题。
selec * from T1 where MFG_NO||MUGIOPCD||NO||MUGIYYMM not in (select MFG_NO||maintain_code||NO||MUGIYYMM from T2)1.T1表的数据有160W条
2.T2表有1000条。当执行的时候太慢了有没有什么好的提速方法,现在查询 大概要2秒。 我一个页面上要调用50次,那就是100秒。实在太久了
selec * from T1 where MFG_NO||MUGIOPCD||NO||MUGIYYMM not in (select MFG_NO||maintain_code||NO||MUGIYYMM from T2)1.T1表的数据有160W条
2.T2表有1000条。当执行的时候太慢了有没有什么好的提速方法,现在查询 大概要2秒。 我一个页面上要调用50次,那就是100秒。实在太久了
where not exists (select 1 from t2
where t2.MFC_NO=t1.MFC_NO
and t2.MUGIOPCD=t1.MUGIOPCD
and t2.NO=t1.NO
and t2.MUGIYYMM=t1.MUGIYYMM );
where not exists
(select 1 from t2
where ( t2.MFC_NO=t1.MFC_NO or (t1.MFC_NO is null and t2.MFC_NO is null ) )
and ( t2.MUGIOPCD=t1.MUGIOPCD or ( t1.MUGIOPCD is null and t2.MUGIOPCD is null ) )
and ( t2.NO=t1.NO or ( t1.NO is null and t2.NO is null )
and ( t2.MUGIYYMM=t1.MUGIYYMM or ( t1.MUGIYYMM is null and t2.MUGIYYMM is null ) )
);