在oracle中优化选择查询的提示?

时间:2018-07-09 11:17:41

标签: oracle performance plsql

如何在Oracle plsql中调整查询? 以下是我尝试过的步骤。 1.我收集了统计数据,任何桌子上都没有锁。 2,索引已经在列上创建了,主要是我们有唯一的约束。 3.我尝试使用说明计划...以下是计划 4.帮助我知道如何减少嵌套循环以及哪种连接最好?

            Plan hash value: 1793839048

            -------------------------------------------------------------------------------------------------------------------------------------------------------------
            | Id  | Operation                                                    | Name                 | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
            -------------------------------------------------------------------------------------------------------------------------------------------------------------
            |   0 | SELECT STATEMENT                                             |                      |     1 |   697 |       | 87213   (3)| 00:00:04 |       |       |
            |   1 |  SORT AGGREGATE                                              |                      |     1 |   697 |       |            |          |       |       |
            |*  2 |   HASH JOIN RIGHT OUTER                                      |                      | 24099 |    16M|       | 87211   (3)| 00:00:04 |       |       |
            |   3 |    VIEW                                                      | VW_DCL_CD4E1359      |     1 |    86 |       |     3   (0)| 00:00:01 |       |       |
            |   4 |     NESTED LOOPS                                             |                      |     1 |    67 |       |     3   (0)| 00:00:01 |       |       |
            |   5 |      TABLE ACCESS BY INDEX ROWID                             | SETUP_MASTER         |     1 |    40 |       |     1   (0)| 00:00:01 |       |       |
            |*  6 |       INDEX UNIQUE SCAN                                      | PK_172               |     1 |       |       |     1   (0)| 00:00:01 |       |       |
            |*  7 |      INDEX RANGE SCAN                                        | PK_513               |     1 |    27 |       |     2   (0)| 00:00:01 |       |       |
            |*  8 |    HASH JOIN RIGHT OUTER                                     |                      | 24099 |    14M|       | 87208   (3)| 00:00:04 |       |       |
            |   9 |     VIEW                                                     | VW_DCL_CD4E1359      |     1 |    86 |       |     3   (0)| 00:00:01 |       |       |
            |  10 |      NESTED LOOPS                                            |                      |     1 |    67 |       |     3   (0)| 00:00:01 |       |       |
            |  11 |       TABLE ACCESS BY INDEX ROWID                            | SETUP_MASTER         |     1 |    40 |       |     1   (0)| 00:00:01 |       |       |
            |* 12 |        INDEX UNIQUE SCAN                                     | PK_172               |     1 |       |       |     1   (0)| 00:00:01 |       |       |
            |* 13 |       INDEX RANGE SCAN                                       | PK_513               |     1 |    27 |       |     2   (0)| 00:00:01 |       |       |
            |  14 |     NESTED LOOPS OUTER                                       |                      | 24099 |    12M|       | 87205   (3)| 00:00:04 |       |       |
            |  15 |      MERGE JOIN CARTESIAN                                    |                      | 24099 |    12M|       | 38925   (7)| 00:00:02 |       |       |
            |* 16 |       HASH JOIN OUTER                                        |                      | 28943 |    13M|    13M| 30615   (6)| 00:00:02 |       |       |
            |  17 |        PART JOIN FILTER CREATE                               | :BF0000              | 28943 |    13M|       | 24307   (6)| 00:00:01 |       |       |
            |* 18 |         HASH JOIN RIGHT OUTER                                |                      | 28943 |    13M|       | 24307   (6)| 00:00:01 |       |       |
            |  19 |          PARTITION RANGE SINGLE                              |                      | 53598 |  3192K|       |  5089   (5)| 00:00:01 |     2 |     2 |
            |* 20 |           TABLE ACCESS STORAGE FULL                          | REV_BIHIER           | 53598 |  3192K|       |  5089   (5)| 00:00:01 |     2 |     2 |
            |* 21 |          HASH JOIN OUTER                                     |                      | 27296 |    10M|    10M| 19217   (6)| 00:00:01 |       |       |
            |  22 |           PART JOIN FILTER CREATE                            | :BF0001              | 27296 |     9M|       | 12918   (6)| 00:00:01 |       |       |
            |* 23 |            HASH JOIN OUTER                                   |                      | 27296 |     9M|  9440K| 12918   (6)| 00:00:01 |       |       |
            |  24 |             PART JOIN FILTER CREATE                          | :BF0002              | 27296 |  9116K|       |  6622   (4)| 00:00:01 |       |       |
            |* 25 |              HASH JOIN                                       |                      | 27296 |  9116K|       |  6622   (4)| 00:00:01 |       |       |
            |* 26 |               TABLE ACCESS STORAGE FULL                      | DIM_REP_LINE         |  4502 | 36016 |       |     2   (0)| 00:00:01 |       |       |
            |* 27 |               HASH JOIN RIGHT OUTER                          |                      | 27299 |  8904K|       |  6619   (4)| 00:00:01 |       |       |
            |  28 |                PARTITION RANGE SINGLE                        |                      |  4501 |   268K|       |  5089   (5)| 00:00:01 |     2 |     2 |
            |* 29 |                 TABLE ACCESS STORAGE FULL                    | REV_BIHIER           |  4501 |   268K|       |  5089   (5)| 00:00:01 |     2 |     2 |
            |* 30 |                HASH JOIN RIGHT OUTER                         |                      | 27299 |  7277K|       |  1530   (2)| 00:00:01 |       |       |
            |  31 |                 TABLE ACCESS BY GLOBAL INDEX ROWID BATCHED   | REV_BIHIER           |     6 |   366 |       |    13   (0)| 00:00:01 |     2 |     2 |
            |* 32 |                  INDEX RANGE SCAN                            | REV_BIHIER_PK        |     4 |       |       |     4   (0)| 00:00:01 |       |       |
            |* 33 |                 HASH JOIN                                    |                      | 27299 |  5651K|       |  1517   (2)| 00:00:01 |       |       |
            |  34 |                  JOIN FILTER CREATE                          | :BF0003              |  9590 |  1788K|       |  1512   (2)| 00:00:01 |       |       |
            |* 35 |                   HASH JOIN                                  |                      |  9590 |  1788K|       |  1512   (2)| 00:00:01 |       |       |
            |* 36 |                    TABLE ACCESS STORAGE FULL                 | DIM_ORG_STRUCTURE    |  1638 | 18018 |       |     3   (0)| 00:00:01 |       |       |
            |* 37 |                    HASH JOIN                                 |                      |  9373 |  1647K|       |  1509   (2)| 00:00:01 |       |       |
            |  38 |                     JOIN FILTER CREATE                       | :BF0004              |  9275 |  1530K|       |  1492   (1)| 00:00:01 |       |       |
            |* 39 |                      HASH JOIN                               |                      |  9275 |  1530K|       |  1492   (1)| 00:00:01 |       |       |
            |* 40 |                       TABLE ACCESS STORAGE FULL              | DIM_GEOGRAPHY        |  1617 | 12936 |       |     2   (0)| 00:00:01 |       |       |
            |* 41 |                       HASH JOIN                              |                      |  9186 |  1444K|       |  1489   (1)| 00:00:01 |       |       |
            |* 42 |                        TABLE ACCESS STORAGE FULL             | DIM_PRODUCT          |   404 |  4848 |       |     2   (0)| 00:00:01 |       |       |
            |* 43 |                        HASH JOIN                             |                      |  9289 |  1351K|       |  1487   (1)| 00:00:01 |       |       |
            |* 44 |                         TABLE ACCESS STORAGE FULL            | DIM_CONSOLIDATION    |    26 |   182 |       |     2   (0)| 00:00:01 |       |       |
            |* 45 |                         HASH JOIN                            |                      |  9471 |  1313K|       |  1485   (1)| 00:00:01 |       |       |
            |* 46 |                          TABLE ACCESS STORAGE FULL           | DIM_DATES            |     1 |     8 |       |     8  (13)| 00:00:01 |       |       |
            |* 47 |                          HASH JOIN                           |                      |  9373 |  1226K|       |  1478   (1)| 00:00:01 |       |       |
            |* 48 |                           TABLE ACCESS STORAGE FULL          | RUN_EXE_PARAMETERS   |     1 |    20 |       |     2   (0)| 00:00:01 |       |       |
            |* 49 |                           HASH JOIN                          |                      | 22583 |  2514K|       |  1475   (1)| 00:00:01 |       |       |
            |* 50 |                            TABLE ACCESS STORAGE FULL         | RUN_EXE_PARAMETERS   |     1 |    20 |       |     2   (0)| 00:00:01 |       |       |
            |  51 |                            NESTED LOOPS                      |                      |   197K|    17M|       |  1473   (1)| 00:00:01 |       |       |
            |  52 |                             NESTED LOOPS                     |                      |   197K|    17M|       |  1473   (1)| 00:00:01 |       |       |
            |  53 |                              NESTED LOOPS                    |                      |     1 |    24 |       |     2   (0)| 00:00:01 |       |       |
            |* 54 |                               INDEX UNIQUE SCAN              | PK_145               |     1 |     4 |       |     0   (0)| 00:00:01 |       |       |
            |* 55 |                               TABLE ACCESS STORAGE FULL      | RUN_EXE_PARAMETERS   |     1 |    20 |       |     2   (0)| 00:00:01 |       |       |
            |* 56 |                              INDEX RANGE SCAN                | IDX1                 | 17626 |       |       |   557   (1)| 00:00:01 |       |       |
            |* 57 | ID                          TABLE ACCESS BY GLOBAL INDEX ROW | STG_GL_DATA          |   354K|    23M|       |  1471   (1)| 00:00:01 |  1004 |  1004 |
            |* 58 |  ROWS                        TABLE ACCESS STORAGE FULL FIRST | SETUP_MASTER         |     1 |    57 |       |     2   (0)| 00:00:01 |       |       |
            |  59 |                     JOIN FILTER USE                          | :BF0004              | 95910 |  1030K|       |    17  (42)| 00:00:01 |       |       |
            |* 60 |                      TABLE ACCESS STORAGE FULL               | DIM_ORG_UNIT         | 95910 |  1030K|       |    17  (42)| 00:00:01 |       |       |
            |  61 |                  JOIN FILTER USE                             | :BF0003              | 67055 |  1375K|       |     5  (20)| 00:00:01 |       |       |
            |* 62 |                   TABLE ACCESS STORAGE FULL                  | MAP_GL_CODE_REP_LINE | 67055 |  1375K|       |     5  (20)| 00:00:01 |       |       |
            |  63 |             PARTITION RANGE JOIN-FILTER                      |                      |    21M|   695M|       |  3333   (8)| 00:00:01 |:BF0002|:BF0002|
            |  64 |              TABLE ACCESS STORAGE FULL                       | REV_LOCALE_HIER      |    21M|   695M|       |  3333   (8)| 00:00:01 |:BF0002|:BF0002|
            |  65 |           PARTITION RANGE JOIN-FILTER                        |                      |    21M|   695M|       |  3333   (8)| 00:00:01 |:BF0001|:BF0001|
            |  66 |            TABLE ACCESS STORAGE FULL                         | REV_LOCALE_HIER      |    21M|   695M|       |  3333   (8)| 00:00:01 |:BF0001|:BF0001|
            |  67 |        PARTITION RANGE JOIN-FILTER                           |                      |    21M|   695M|       |  3333   (8)| 00:00:01 |:BF0000|:BF0000|
            |  68 |         TABLE ACCESS STORAGE FULL                            | REV_LOCALE_HIER      |    21M|   695M|       |  3333   (8)| 00:00:01 |:BF0000|:BF0000|
            |  69 |       BUFFER SORT                                            |                      |     1 |    20 |       | 35591   (7)| 00:00:02 |       |       |
            |* 70 |        TABLE ACCESS STORAGE FULL                             | RUN_EXE_PARAMETERS   |     1 |    20 |       |     0   (0)| 00:00:01 |       |       |
            |  71 |      VIEW                                                    | VW_LAT_CD4E1359      |     1 |       |       |     2   (0)| 00:00:01 |       |       |
            |* 72 |       TABLE ACCESS STORAGE FULL                              | DIM_LOB              |     1 |    16 |       |     2   (0)| 00:00:01 |       |       |
            -------------------------------------------------------------------------------------------------------------------------------------------------------------

            Predicate Information (identified by operation id):
            ---------------------------------------------------

               2 - access("ITEM_0"(+)="STG_GL_DATA"."V_CCY_CODE" AND "ITEM_1"(+)="STG_GL_DATA"."FIC_MIS_DATE" AND "ITEM_2"(+)="DIM_ORG_STRUCTURE"."V_LCY_CODE" 
                          AND "ITEM_6"(+)="DIM_RUN"."N_RUN_SKEY")
               6 - access("SETUP_MASTER"."V_COMPONENT_CODE"='DEFAULT_FX_RATE_SRC')
               7 - access("FSI_EXCHANGE_RATES_LCY"."N_RUN_SKEY"=459 AND "FSI_EXCHANGE_RATES_LCY"."FIC_MIS_DATE"=TO_DATE(' 2017-09-30 00:00:00', 'syyyy-mm-dd 
                          hh24:mi:ss') AND "FSI_EXCHANGE_RATES_LCY"."N_TENOR"=0 AND "FSI_EXCHANGE_RATES_LCY"."V_RATE_DATA_SOURCE_CD"="SETUP_MASTER"."V_COMPONENT_VALUE")
                   filter("FSI_EXCHANGE_RATES_LCY"."V_RATE_DATA_SOURCE_CD"="SETUP_MASTER"."V_COMPONENT_VALUE" AND "FSI_EXCHANGE_RATES_LCY"."N_TENOR"=0)
               8 - access("ITEM_4"(+)="STG_GL_DATA"."V_CCY_CODE" AND "ITEM_5"(+)="STG_GL_DATA"."FIC_MIS_DATE" AND 
                          "ITEM_6"(+)="RUN_EXE_PARAMETERS_RCY"."V_PARAM_VALUE_CODE" AND "ITEM_6"(+)="DIM_RUN"."N_RUN_SKEY")
              12 - access("SETUP_MASTER"."V_COMPONENT_CODE"='DEFAULT_FX_RATE_SRC')
              13 - access("FSI_EXCHANGE_RATES_RCY"."N_RUN_SKEY"=459 AND "FSI_EXCHANGE_RATES_RCY"."FIC_MIS_DATE"=TO_DATE(' 2017-09-30 00:00:00', 'syyyy-mm-dd 
                          hh24:mi:ss') AND "FSI_EXCHANGE_RATES_RCY"."N_TENOR"=0 AND "FSI_EXCHANGE_RATES_RCY"."V_RATE_DATA_SOURCE_CD"="SETUP_MASTER"."V_COMPONENT_VALUE")
                   filter("FSI_EXCHANGE_RATES_RCY"."V_RATE_DATA_SOURCE_CD"="SETUP_MASTER"."V_COMPONENT_VALUE" AND "FSI_EXCHANGE_RATES_RCY"."N_TENOR"=0)
              16 - access("RBH1"."VERSION_NO"="RLH1"."VERSION_NO"(+) AND "RBH1"."SHRT_DESC"="RLH1"."METADATA_KEY"(+) AND "RBH1"."VERSION_NO"=CASE  WHEN 
                          ("RLH1"."VERSION_NO"(+) IS NOT NULL) THEN 0 ELSE 0 END  AND "RBH1"."HIER_CODE"=CASE  WHEN ("RLH1"."VERSION_NO"(+) IS NOT NULL) THEN 'HMGMT001' ELSE 
                          'HMGMT001' END )
              18 - access("MAPR"."V_MEMBER_1"="RBH1"."CODE"(+))
              20 - storage("RBH1"."HIER_CODE"(+)='HMGMT001' AND "RBH1"."VERSION_NO"(+)=0)
                   filter("RBH1"."HIER_CODE"(+)='HMGMT001' AND "RBH1"."VERSION_NO"(+)=0)
              21 - access("RBH2"."VERSION_NO"="RLH2"."VERSION_NO"(+) AND "RBH2"."SHRT_DESC"="RLH2"."METADATA_KEY"(+) AND "RBH2"."VERSION_NO"=CASE  WHEN 
                          ("RLH2"."VERSION_NO"(+) IS NOT NULL) THEN 0 ELSE 0 END  AND "RBH2"."HIER_CODE"=CASE  WHEN ("RLH2"."VERSION_NO"(+) IS NOT NULL) THEN 'HMGMT002' ELSE 
                          'HMGMT002' END )
              23 - access("RBH3"."VERSION_NO"="RLH3"."VERSION_NO"(+) AND "RBH3"."SHRT_DESC"="RLH3"."METADATA_KEY"(+) AND "RBH3"."VERSION_NO"=CASE  WHEN 
                          ("RLH3"."VERSION_NO"(+) IS NOT NULL) THEN 0 ELSE 0 END  AND "RBH3"."HIER_CODE"=CASE  WHEN ("RLH3"."VERSION_NO"(+) IS NOT NULL) THEN 'HMGMT003' ELSE 
                          'HMGMT003' END )
              25 - access("DIM_REP_LINE"."N_REP_LINE_CD"=TO_NUMBER("MAPR"."V_MEMBER_3"))
              26 - storage(NVL("DIM_REP_LINE"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
                   filter(NVL("DIM_REP_LINE"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
              27 - access("MAPR"."V_MEMBER_3"="RBH3"."CODE"(+))
              29 - storage("RBH3"."HIER_CODE"(+)='HMGMT003' AND "RBH3"."VERSION_NO"(+)=0)
                   filter("RBH3"."HIER_CODE"(+)='HMGMT003' AND "RBH3"."VERSION_NO"(+)=0)
              30 - access("MAPR"."V_MEMBER_2"="RBH2"."CODE"(+))
              32 - access("RBH2"."HIER_CODE"(+)='HMGMT002' AND "RBH2"."VERSION_NO"(+)=0)
                   filter("RBH2"."VERSION_NO"(+)=0)
              33 - access("MAPR"."V_MEMBER_1"="STG_GL_DATA"."V_GL_CODE" AND "MAPR"."V_MEMBER_2"=NVL("STG_GL_DATA"."F_DRCR_INDICATOR",'M'))
              35 - access("STG_GL_DATA"."V_LV_CODE"="DIM_ORG_STRUCTURE"."V_ENTITY_CODE")
              36 - storage(NVL("DIM_ORG_STRUCTURE"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
                   filter(NVL("DIM_ORG_STRUCTURE"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
              37 - access("STG_GL_DATA"."V_ORG_UNIT_CODE"="DIM_ORG_UNIT"."V_ORG_UNIT_CODE")
              39 - access("STG_GL_DATA"."V_BRANCH_CODE"="DIM_GEOGRAPHY"."V_ACCT_BRANCH_CODE")
              40 - storage(NVL("DIM_GEOGRAPHY"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
                   filter(NVL("DIM_GEOGRAPHY"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
              41 - access("STG_GL_DATA"."V_PROD_CODE"="DIM_PRODUCT"."V_PROD_CODE")
              42 - storage(NVL("DIM_PRODUCT"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
                   filter(NVL("DIM_PRODUCT"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
              43 - access("DIM_CONSOLIDATION"."V_CONSOLIDATION"="STG_GL_DATA"."V_SCENARIO_CODE")
              44 - storage(NVL("DIM_CONSOLIDATION"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
                   filter(NVL("DIM_CONSOLIDATION"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
              45 - access("STG_GL_DATA"."FIC_MIS_DATE"="DIM_DATES"."D_CALENDAR_DATE")
              46 - storage("DIM_DATES"."D_CALENDAR_DATE"=TO_DATE(' 2017-09-30 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
                   filter("DIM_DATES"."D_CALENDAR_DATE"=TO_DATE(' 2017-09-30 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
              47 - access("STG_GL_DATA"."F_CONSOLIDATION_FLAG"=CASE "RUN_EXE_PARAMETERS_CONSO"."V_PARAM_VALUE_CODE" WHEN 'CONSL' THEN 'C' ELSE 'S' END )
              48 - storage("RUN_EXE_PARAMETERS_CONSO"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_CONSO"."V_PARAM_ID"='CONSOTYPE')
                   filter("RUN_EXE_PARAMETERS_CONSO"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_CONSO"."V_PARAM_ID"='CONSOTYPE')
              49 - access("STG_GL_DATA"."V_GAAP_CODE"="RUN_EXE_PARAMETERS_GAAP"."V_PARAM_VALUE_CODE")
              50 - storage("RUN_EXE_PARAMETERS_GAAP"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_GAAP"."V_PARAM_ID"='GAAP')
                   filter("RUN_EXE_PARAMETERS_GAAP"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_GAAP"."V_PARAM_ID"='GAAP')
              54 - access("DIM_RUN"."N_RUN_SKEY"=459)
              55 - storage("RUN_EXE_PARAMETERS_LE"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_LE"."V_PARAM_ID"='LE')
                   filter("RUN_EXE_PARAMETERS_LE"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_LE"."V_PARAM_ID"='LE')
              56 - access("STG_GL_DATA"."V_LV_CODE"="RUN_EXE_PARAMETERS_LE"."V_PARAM_VALUE_CODE")
              57 - filter("STG_GL_DATA"."FIC_MIS_DATE"=TO_DATE(' 2017-09-30 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "STG_GL_DATA"."V_FINANCIAL_ELEMENT_CODE"= 
                          (SELECT "V_COMPONENT_VALUE" FROM "SETUP_MASTER" "SETUP_MASTER" WHERE "V_COMPONENT_DESC"='DEFAULT_FINANCIAL_ELEMENT'))
              58 - storage("V_COMPONENT_DESC"='DEFAULT_FINANCIAL_ELEMENT')
                   filter("V_COMPONENT_DESC"='DEFAULT_FINANCIAL_ELEMENT')
              60 - storage(NVL("DIM_ORG_UNIT"."F_LATEST_RECORD_INDICATOR",'Y')='Y' AND SYS_OP_BLOOM_FILTER(:BF0004,"DIM_ORG_UNIT"."V_ORG_UNIT_CODE"))
                   filter(NVL("DIM_ORG_UNIT"."F_LATEST_RECORD_INDICATOR",'Y')='Y' AND SYS_OP_BLOOM_FILTER(:BF0004,"DIM_ORG_UNIT"."V_ORG_UNIT_CODE"))
              62 - storage(SYS_OP_BLOOM_FILTER(:BF0003,"MAPR"."V_MEMBER_1","MAPR"."V_MEMBER_2"))
                   filter(SYS_OP_BLOOM_FILTER(:BF0003,"MAPR"."V_MEMBER_1","MAPR"."V_MEMBER_2"))
              70 - storage("RUN_EXE_PARAMETERS_RCY"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_RCY"."V_PARAM_ID"='RCY')
                   filter("RUN_EXE_PARAMETERS_RCY"."N_RUN_SKEY"=459 AND "RUN_EXE_PARAMETERS_RCY"."V_PARAM_ID"='RCY')
              72 - storage("DIM_LOB"."V_LOB_CODE"='MSG' AND NVL("DIM_LOB"."F_LATEST_RECORD_INDICATOR",'Y')='Y')
                   filter("DIM_LOB"."V_LOB_CODE"='MSG' AND NVL("DIM_LOB"."F_LATEST_RECORD_INDICATOR",'Y')='Y')

0 个答案:

没有答案