1. 程式人生 > >標量子查詢SQL改寫

標量子查詢SQL改寫

SELECT STATEMENT | | 5 | 670 | 14 (8)| 00:00:01 | | 1 | SORT AGGREGATE | | 1 | 74 | | | |* 2 | TABLE ACCESS BY INDEX ROWID | TBL_SP_SALES_RECORDS | 1 | 74 | 9
(0)| 00:00:01 | |* 3 | INDEX RANGE SCAN | IDX_SSR_STAREA | 7 | | 4 (0)| 00:00:01 | | 4 | SORT AGGREGATE | | 1 | 74 | | | |* 5 | TABLE ACCESS BY INDEX ROWID | TBL_SP_SALES_RECORDS | 1
| 74 | 9 (0)| 00:00:01 | |* 6 | INDEX RANGE SCAN | IDX_SSR_STAREA | 7 | | 4 (0)| 00:00:01 | | 7 | SORT AGGREGATE | | 1 | 26 | | | |* 8 | TABLE ACCESS BY INDEX ROWID | TBL_DISTURB_CUSTOMER_RECORDS | 289
| 7514 | 82 (0)| 00:00:01 | |* 9 | INDEX RANGE SCAN | IDX_TARGET_NAME | 2993 | | 20 (0)| 00:00:01 | | 10 | SORT AGGREGATE | | 1 | 26 | | | |* 11 | TABLE ACCESS BY INDEX ROWID | TBL_DISTURB_CUSTOMER_RECORDS | 4058 | 103K| 82 (0)| 00:00:01 | |* 12 | INDEX RANGE SCAN | IDX_TARGET_NAME | 2993 | | 20 (0)| 00:00:01 | |* 13 | HASH JOIN | | 5 | 670 | 14 (8)| 00:00:01 | |* 14 | HASH JOIN | | 5 | 450 | 11 (10)| 00:00:01 | |* 15 | TABLE ACCESS BY INDEX ROWID| TBL_SP_CAMPAIGN | 5 | 225 | 7 (0)| 00:00:01 | |* 16 | INDEX RANGE SCAN | IDX_P_CREATE_TIME | 6 | | 2 (0)| 00:00:01 | | 17 | TABLE ACCESS FULL | TBL_SP_TASK | 112 | 5040 | 3 (0)| 00:00:01 | | 18 | TABLE ACCESS FULL | TBL_TASK_TARGETDATA | 112 | 4928 | 3 (0)| 00:00:01 | -------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("SR"."TASK_ID"=:B1 AND "SR"."CHANNEL_ID"=:B2 AND "SR"."IS_CONN"='1') 3 - access("SR"."SALES_TIME">='2017-10-01 00:00:00' AND "SR"."SALES_TIME"<='2017-10-27 00:00:00') filter(SUBSTR("SALES_TIME",1,10)>='2017-10-01' AND SUBSTR("SALES_TIME",1,10)<='2017-10-27') 5 - filter("SR"."TASK_ID"=:B1 AND "SR"."CHANNEL_ID"=:B2 AND "SR"."IS_CONN"='0') 6 - access("SR"."SALES_TIME">='2017-10-01 00:00:00' AND "SR"."SALES_TIME"<='2017-10-27 00:00:00') filter(SUBSTR("SALES_TIME",1,10)>='2017-10-01' AND SUBSTR("SALES_TIME",1,10)<='2017-10-27') 8 - filter("CR"."DISTURB_TYPE"='98' OR "CR"."DISTURB_TYPE"='99') 9 - access("CR"."TARGET_NAME"=:B1) 11 - filter("CR"."DISTURB_TYPE"<>'98' AND "CR"."DISTURB_TYPE"<>'99') 12 - access("CR"."TARGET_NAME"=:B1) 13 - access("T"."TASK_ID"="TT"."TASK_ID") 14 - access("C"."CAMPAIGN_ID"="T"."CAMPAIGN_ID") 15 - filter("C"."CREATOR"='fuzhou' OR "C"."CREATOR"='lingde' OR "C"."CREATOR"='longyan' OR "C"."CREATOR"='nanping' OR "C"."CREATOR"='putian' OR "C"."CREATOR"='quanzhou' OR "C"."CREATOR"='sanming' OR "C"."CREATOR"='xiamen' OR "C"."CREATOR"='zhangzhou') 16 - access("C"."CREATE_TIME">='2017-10-01 00:00:00' AND "C"."CREATE_TIME"<='2017-10-27 00:00:00')