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
  • 相关阅读:
    mysql备份监控脚本
    关于ibatis的缓存的
    一些好用的软件和工具
    一,关于mongDB+SpringMVC【org.springframework.data.mongodb.core.MongoTemplate】
    java中的String内存分配原理
    java条件结构
    java运算符与选择结构
    JAVA变量补充
    JAVA变量
    java基础01
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348748.html
Copyright © 2011-2022 走看看