zoukankan      html  css  js  c++  java
  • 再次遭遇笛卡尔积

    改为MERGE /*+ordered*/ INTO YJBZH_GRXDFHZMXJL GRXDFHZMXJL USING ( SELECT 
    A.AGMT_ID AS AGMT_ID, B.CUST_NAME AS CUST_NAME FROM 
    DWF.F_AGT_CADB_BOOK_H A, DWF.F_AGT_SAVB_BASICINFO_H B WHERE A.START_DT 
    <= TO_DATE(:B1 ,'yyyy-mm-dd') AND A.END_DT > TO_DATE(:B1 ,'yyyy-mm-dd') 
    AND B.START_DT <= TO_DATE(:B1 ,'yyyy-mm-dd') AND B.END_DT > TO_DATE(:B1 
    ,'yyyy-mm-dd') AND A.MASTER_CARD_NO = B.AGMT_ID ) SAVB_BASICINFO ON ( 
    RTRIM(GRXDFHZMXJL.DFZH) = SAVB_BASICINFO.AGMT_ID AND CJRQ = 
    TO_CHAR(TO_DATE(:B1 , 'YYYY-MM-DD'),'yyyymmdd') ) WHEN MATCHED THEN 
    UPDATE SET GRXDFHZMXJL.DFHM = SAVB_BASICINFO.CUST_NAME
    
    加了/*+order*/ 还是出现了笛卡尔积,不得不再加hints
    
    SQL_ID  5wyfn0trgu5rx, child number 0
    -------------------------------------
    MERGE /*+  ORDERED  use_hash(A B) use_hash(A GRXDFHZMXJL)*/ INTO 
    YJBZH_GRXDFHZMXJL GRXDFHZMXJL USING ( SELECT A.AGMT_ID AS AGMT_ID, 
    B.CUST_NAME AS CUST_NAME FROM DWF.F_AGT_CADB_BOOK_H A, 
    DWF.F_AGT_SAVB_BASICINFO_H B WHERE A.START_DT <= TO_DATE(:B1 
    ,'yyyy-mm-dd') AND A.END_DT > TO_DATE(:B1 ,'yyyy-mm-dd') AND B.START_DT 
    <= TO_DATE(:B1 ,'yyyy-mm-dd') AND B.END_DT > TO_DATE(:B1 ,'yyyy-mm-dd') 
    AND A.MASTER_CARD_NO = B.AGMT_ID ) SAVB_BASICINFO ON ( 
    RTRIM(GRXDFHZMXJL.DFZH) = SAVB_BASICINFO.AGMT_ID AND CJRQ = 
    TO_CHAR(TO_DATE(:B1 , 'YYYY-MM-DD'),'yyyymmdd') ) WHEN MATCHED THEN 
    UPDATE SET GRXDFHZMXJL.DFHM = SAVB_BASICINFO.CUST_NAME
     
    Plan hash value: 2400855618
     
    --------------------------------------------------------------------------------------------------------
    | Id  | Operation             | Name                   | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------------
    |   0 | MERGE STATEMENT       |                        |       |       |       |   125K(100)|          |
    |   1 |  MERGE                | YJBZH_GRXDFHZMXJL      |       |       |       |            |          |
    |   2 |   VIEW                |                        |       |       |       |            |          |
    |*  3 |    HASH JOIN          |                        |     1 |  1862 |       |   125K  (2)| 00:25:01 |
    |*  4 |     TABLE ACCESS FULL | YJBZH_GRXDFHZMXJL      |     1 |  1762 |       | 12948   (1)| 00:02:36 |
    |*  5 |     HASH JOIN         |                        |    11M|  1074M|   374M|   112K  (2)| 00:22:25 |
    |*  6 |      TABLE ACCESS FULL| F_AGT_CADB_BOOK_H      |  5951K|   306M|       | 69245   (2)| 00:13:51 |
    |*  7 |      TABLE ACCESS FULL| F_AGT_SAVB_BASICINFO_H |  2120K|    93M|       | 18256   (2)| 00:03:40 |
    --------------------------------------------------------------------------------------------------------
     
    Predicate Information (identified by operation id):
    ---------------------------------------------------
     
       3 - access("A"."AGMT_ID"=RTRIM("GRXDFHZMXJL"."DFZH"))
       4 - filter("CJRQ"=TO_CHAR(TO_DATE(:B1,'YYYY-MM-DD'),'yyyymmdd'))
       5 - access("A"."MASTER_CARD_NO"="B"."AGMT_ID")
       6 - filter(("A"."MASTER_CARD_NO" IS NOT NULL AND "A"."START_DT"<=TO_DATE(:B1,'yyyy-mm-dd') 
                  AND "A"."END_DT">TO_DATE(:B1,'yyyy-mm-dd')))
       7 - filter(("B"."START_DT"<=TO_DATE(:B1,'yyyy-mm-dd') AND 
                  "B"."END_DT">TO_DATE(:B1,'yyyy-mm-dd')))
     
    
    
    
    
    
    

  • 相关阅读:
    linux上安装mysql
    linux 上nginx配置
    js人民币数字转大写
    pm2常用命令
    基于redis实现分布式锁
    Enterprise Architect 14破解版 安装包 安装教程
    一些有用的链接
    Linux安装Zookeeper
    根据朋友圈的网易云音乐分享找到人
    我的待做事项
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13352379.html
Copyright © 2011-2022 走看看