調優過程
原始SQL如下:
SELECTDISTINCTCASE
WHEN REGEXP_LIKE(B.REGISTERORGID, .XM) THEN
SUBSTR(B.REGISTERORGID,
1,
INSTR(B.REGISTERORGID, .XM, 1) - 1)
ELSE
B.REGISTERORGID
END,
B.SERVNUMBER,
C.RECOPID,
C.RECDATE,
B.SUBSID
FROM TBCS.SUBSCRIBER PARTITION(SUBSCRIBER_724) B,
TBCS.RECEPTION PARTITION(RECEPTION_724_202202) C
WHERE B.NETTYPE = GSM
AND B.ACTIVE = 1
AND B.STATUS = US10
AND B.CREATEDATE > TO_DATE(20220201, YYYYMMDD)
AND B.REGISTERORGID LIKEHB.JM.03.%
AND C.SERVNUMBER = B.SERVNUMBER
AND C.RECDATE > TO_DATE(20220201, YYYYMMDD)
AND C.RECDEFID = Install
AND B.SUBSID NOTIN
(SELECT A.SUBSID
FROM TBCS.SUBS_PRODUCT PARTITION(SUBS_PRODUCT_724) A
WHERE A.PRODID LIKEG238354%
AND A.APPLYDATE > TO_DATE(20220201, YYYYMMDD)
UNIONALL
SELECT A.SUBSID
FROM TBCS.SUBS_PRODUCT PARTITION(SUBS_PRODUCT_724) A
WHERE A.PRODID = MP9990103000300
AND A.APPLYDATE > TO_DATE(20220201, YYYYMMDD)
UNIONALL
SELECT/*+ index(a IDX_SUBS_PRODUCT_PRODID) */
A.SUBSID
FROM TBCS.SUBS_PRODUCT PARTITION(SUBS_PRODUCT_724) A
WHERE A.PRODID IN (SELECT D.PRODID
FROM TBCS.PRODUCT D
WHERE D.PRODNAME LIKEXX%XXX%
OR D.PRODNAME LIKEXX%XXX%
OR D.PRODNAME LIKEXX%XXX%%
OR D.PRODNAME LIKEXX%XXX%%
OR D.PRODNAME LIKE%XX%
OR D.PRODNAME LIKE%XX%)
AND A.APPLYDATE > TO_DATE(20220201, YYYYMMDD))
ORDERBYCASE
WHEN REGEXP_LIKE(B.REGISTERORGID, .XM) THEN
SUBSTR(B.REGISTERORGID, 1, INSTR(B.REGISTERORGID, .XM, 1) - 1)
ELSE
B.REGISTERORGID
END,
C.RECDATE;
分析總結
子查詢展開(Subquery Unnesting)是優化器處理帶子查詢的目標sql的一種優化手段。
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/129420.html
閱讀 1353·2023-01-11 13:20
閱讀 1699·2023-01-11 13:20
閱讀 1211·2023-01-11 13:20
閱讀 1902·2023-01-11 13:20
閱讀 4161·2023-01-11 13:20
閱讀 2751·2023-01-11 13:20
閱讀 1397·2023-01-11 13:20
閱讀 3664·2023-01-11 13:20