需要调优DB2左外连接查询

时间:2014-08-27 05:52:41

标签: sql oracle db2

我正在尝试调整以下查询

select distinct N9.N9HOTX AccountNo,O2.O2GKTX RouterTypeName, N9.N9E3CD Router, KE.KEU2CT DueSinceDate,
KF1.KFWNVA MinPayment, N9.N9UOAM OS, N9.N9V3NB WBV, KF2.KFWJVA Overlimit,KG.KGATTT BlockCode1,
KG.KGAUTT BlockCode2, KF1.KFWGVA currentAmt, KF1.KFWHVA DaysGapOne, KF1.KFWIVA DaysGapTwo,
KF1.KFWJVA DaysGapThree, KF1.KFWKVA DaysGapFour, KF1.KFWLVA DaysGapFive, NP.NPE2CD ThirdParty,
N9.N9AWCE DebtType, TC.TCX6ST JointBwrInd,TC.TCADCD ClientCode,
TC.TCA0CE DebtItemSurrogate from N9DEBTP N9 
INNER JOIN NNDEBTP NN ON NN.NNE5CD=N9.N9E5CD
INNER JOIN NDDEBTP ON N9.N9E5CD=NDDEBTP.NDE5CD
INNER JOIN join TCDEBTP TC on TC.TCE5CD = N9.N9E5CD and TC.TCAWCE = N9.N9AWCE
left outer join O2DEBTP O2 on O2.O2E3CD=N9.N9E3CD
left outer join KEDEBTP KE on KE.KEMISV='TC' and KE.KEWTCF='ACT' and KE.KEP1ND=TC.TCQCND
left outer join KGDEBTP KG on KG.KGMISV='TC' and KG.KGWTCF='ACT' and KG.KGP1ND=TC.TCQCND
left outer join KFDEBTP KF1 on KF1.KFMISV='TC' and KF1.KFWTCF='AGE' and KF1.KFP1ND=TC.TCQCND
left outer join KFDEBTP KF2 on KF2.KFMISV='TC' and KF2.KFWTCF='SCT' and KF2.KFP1ND=TC.TCQCND
left outer join NPDEBTP NP on NP.NPE5CD = N9.N9E5CD and NP.NPFHSS = 'L'
where N9.N9DDCE in (select distinct NDDDCE from NDDEBTP where NDGDTT in ('CIN_Number')) order by KE.KEU2CT,N9.N9AWCE

由于我依赖于多个表格,因此加载数据大约需要9秒钟。 KGDEBTP,KFDEBTP,KEDEBTP包含大量数据,它包含我正在搜索的列的索引。我没有找到调整它以提高性能的最佳方法。

任何帮助都非常感谢!!!

0 个答案:

没有答案