zoukankan      html  css  js  c++  java
  • 嵌套循环支持等值和非等值连接

    驱动表,外部表
    
    
    被驱动表  内部表
    
     select  /*+ LEADING(e) use_nl(e,d)*/ e.ename,e.job,d.dname from emp e,dept d  where e.deptno=d.deptno and e.sal<2000;
    
    
    select e.*,d.*
      from emp e, dept d
     where e.deptno <> d.deptno
       and e.sal < 2000
       order by 1 asc
    
    
    SQL> set linesize 200
    SQL> set pagesie 200
    SP2-0158: 未知的 SET 选项 "pagesie"
    SQL> set pagesize 200
    SQL> explain plan for select e.*,d.*
      from emp e, dept d
     where e.deptno <> d.deptno
       and e.sal < 2000
       order by 1 asc
      2    3    4    5    6  ;
    
    已解释。
    
    SQL> 
    SQL> select * from table(dbms_xplan.display());
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 4097972272
    
    ----------------------------------------------------------------------------
    | Id  | Operation	    | Name | Rows  | Bytes | Cost (%CPU)| Time	   |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |	   |	25 |  1450 |	11  (10)| 00:00:01 |
    |   1 |  SORT ORDER BY	    |	   |	25 |  1450 |	11  (10)| 00:00:01 |
    |   2 |   NESTED LOOPS	    |	   |	25 |  1450 |	10   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| DEPT |	 4 |	80 |	 3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| EMP  |	 6 |   228 |	 2   (0)| 00:00:01 |
    ----------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - filter("E"."SAL"<2000 AND "E"."DEPTNO"<>"D"."DEPTNO")
    
    已选择16行。
    
    如:>,< >=,<= like
  • 相关阅读:
    一天一个shell实例(1)文本中n个出现频率最高的单词(转)
    JNDI全攻略(一)(转)
    JNDI 学习(转)
    JNDI全攻略(二)(转)
    C#开发系列 文章索引
    AppControls
    JSF系列 文章索引
    [转载]DELPHI组件安装全攻略
    什么是有价值的人生
    [转载]InnoSetup5.2.3啊风增强版 安装代码
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348748.html
Copyright © 2011-2022 走看看