zoukankan      html  css  js  c++  java
  • hash join 内连接可以指定驱动表

    hash join 内连接改变驱动表:
    
    
     select  /*+ swap_join_inputs(e) use_hash(e,d)*/ e.ename,e.job,d.dname from emp e,dept d  where e.deptno=d.deptno 
    SQL> explain plan for  select  /*+ swap_join_inputs(e) use_hash(e,d)*/ e.ename,e.job,d.dname from emp e,dept d  where e.deptno=d.deptno ;
    
    已解释。
    
    SQL>  select * from table(dbms_xplan.display());
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 1123238657
    
    ---------------------------------------------------------------------------
    | Id  | Operation	   | Name | Rows  | Bytes | Cost (%CPU)| Time	  |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |	  |    14 |   420 |	6   (0)| 00:00:01 |
    |*  1 |  HASH JOIN	   |	  |    14 |   420 |	6   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMP  |    14 |   238 |	3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL| DEPT |	4 |    52 |	3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - access("E"."DEPTNO"="D"."DEPTNO")
    
    已选择15行。
    
    
    
    
    select  /*+ swap_join_inputs(d) use_hash(e,d)*/ e.ename,e.job,d.dname from emp e,dept d  where e.deptno=d.deptno
    
    SQL> explain plan for select  /*+ swap_join_inputs(d) use_hash(e,d)*/ e.ename,e.job,d.dname from emp e,dept d  where e.deptno=d.deptno;
    
    已解释。
    
    SQL> select * from table(dbms_xplan.display());
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 615168685
    
    ---------------------------------------------------------------------------
    | Id  | Operation	   | Name | Rows  | Bytes | Cost (%CPU)| Time	  |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |	  |    14 |   420 |	6   (0)| 00:00:01 |
    |*  1 |  HASH JOIN	   |	  |    14 |   420 |	6   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| DEPT |	4 |    52 |	3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL| EMP  |    14 |   238 |	3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - access("E"."DEPTNO"="D"."DEPTNO")
    
    已选择15行。
    
  • 相关阅读:
    使用npm安装一些包失败了的看过来(npm国内镜像介绍)
    利用JMX统计远程JAVA进程的CPU和Memory
    Spring Boot学习笔记
    django数据库时间存储格式问题
    解决 Ubuntu 无法调节屏幕亮度的问题(转)
    django models auto_now和auto_now_add的区别
    django redis操作
    接口测试的工具
    django中migration文件是干啥的
    mysql简单操作(实时更新)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348742.html
Copyright © 2011-2022 走看看