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
  • 相关阅读:
    程序员学习能力提升三要素(转)
    网页游戏框架
    CS心得
    项目主管谈网页游戏:一将功成万骨枯
    分享成为高效程序员的7个重要习惯
    看代码的实质
    点击delphi中wwDBGrid标题进行排序
    DataRow 学习
    学习遇到的问题MVC设置 起始页后怎样恢复
    泛型中的where
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348748.html
Copyright © 2011-2022 走看看