Hi Everyone,
Just joined dbforums family. Thanks for all the sharing.
Here is the scenario that I encounter for the bottleneck sql statement,
The section that I highlighted in red and bold is the most resource hungry query statement. as you can see it require different key column from different tables to become single key search. I tested to separate this out to use load cursor into a table with the index key column - altel_ac_no but the response still not ideal. the total query run end records are estimated 117mil records and it took 22mins just to load into table.
Anyone has better idea to resolve this issue ? All suggestions are welcome. thank you!
Just joined dbforums family. Thanks for all the sharing.
Here is the scenario that I encounter for the bottleneck sql statement,
Code:
SELECT A.CIF_NO, A.COLL_NO, A.ACCT_NO, A.CR_LINE, A.PROPORTION,
A.DT_CREATED, A.FILE_RUN_ID, A.ROW_NO, A.DT_FILE, min(
B.AR_ID)as AR_ID, B.SRC_UNQ_ID_TP AS SRC_STM_ID, min(C.IP_ID)as IP_ID, D.RI_SRC_KEY
FROM DSSSTG.SG1_COL_DSKLM01 A LEFT OUTER JOIN
(SELECT SRC_UNQ_ID, IP_ID
FROM DSSSTG.SG_SRC_X_IP
WHERE SRC_STM_ID='BTR' )C ON A.ACCT_NO=C.SRC_UNQ_ID LEFT OUTER
JOIN
(SELECT SUBSTR(ACCT_NO, LENGTH(ACCT_NO)-2, 1)AS RI_SRC_KEY,
ROW_NO
FROM DSSSTG.SG1_COL_DSKLM01)D ON A.ROW_NO=D.ROW_NO LEFT OUTER
JOIN
(SELECT A.ALTEL_AC_NO, D.AR_ID, D.SRC_UNQ_ID_TP, A.ROW_NO
FROM
(SELECT (CASE
WHEN SUBSTR(A.ACCT_NO, LENGTH(A.ACCT_NO)-2, 1)IN ('5' , '6' ,'9' )
THEN '35001' ||RTRIM(D.OU_CODE)||'0000' ||RTRIM(A.ACCT_NO)
ELSE '35001' ||RTRIM(D.OU_CODE)||RTRIM(A.ACCT_NO)END)AS
ALTEL_AC_NO, A.ROW_NO
FROM DSSSTG.SG1_COL_DSKLM01 A, DSSBDW.OU D
WHERE D.BR_NO=LEFT(A.ACCT_NO, 4))A, DSSSTG.SG_SRC_X_AR D
WHERE A.ALTEL_AC_NO=D.SRC_UNQ_ID)B ON A.ROW_NO=B.ROW_NO
group by A.CIF_NO, A.COLL_NO, A.ACCT_NO, A.CR_LINE, A.PROPORTION,
A.DT_CREATED, A.FILE_RUN_ID, A.ROW_NO, A.DT_FILE,
B.SRC_UNQ_ID_TP, D.RI_SRC_KEY;
The section that I highlighted in red and bold is the most resource hungry query statement. as you can see it require different key column from different tables to become single key search. I tested to separate this out to use load cursor into a table with the index key column - altel_ac_no but the response still not ideal. the total query run end records are estimated 117mil records and it took 22mins just to load into table.
Anyone has better idea to resolve this issue ? All suggestions are welcome. thank you!