zoukankan      html  css  js  c++  java
  • 查看Oracle SQL执行计划的常用方式

    在查看SQL执行计划的时候有很多方式

    我常用的方式有三种

    SQL> explain plan for
    2 select * from scott.emp where ename='KING';

    已解释。

    第一种 最常用的

    SQL> select * from table(dbms_xplan.display);

    Plan hash value: 3956160932
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |     1 |    38 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |     1 |    38 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("ENAME"='KING')
    
    已选择13行。

    第二种

    SQL> select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));

    Plan hash value: 2637181423
    
    ---------------------------------------------------
    | Id  | Operation          | Name        | E-Rows |
    ---------------------------------------------------
    |   0 | DELETE STATEMENT   |             |        |
    |   1 |  DELETE            | PLAN_TABLE$ |        |
    |*  2 |   TABLE ACCESS FULL| PLAN_TABLE$ |      1 |
    ---------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - filter("STATEMENT_ID"=:1)
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
       - Warning: basic plan statistics not available. These are only collected when:
           * hint 'gather_plan_statistics' is used for the statement or
           * parameter 'statistics_level' is set to 'ALL', at session or system level
    
    
    已选择26行。

    第三种

    SQL> select * from table(dbms_xplan.display(null,null,'ADVANCED -PROJECTION'));

    Plan hash value: 3956160932
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |     1 |    38 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |     1 |    38 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    Query Block Name / Object Alias (identified by operation id):
    -------------------------------------------------------------
    
       1 - SEL$1 / EMP@SEL$1
    
    Outline Data
    -------------
    
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$1" "EMP"@"SEL$1")
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          DB_VERSION('11.2.0.1')
          OPTIMIZER_FEATURES_ENABLE('11.2.0.1')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
      */
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("ENAME"='KING')
    
    已选择32行。
  • 相关阅读:
    分布式系统基础设施
    6种负载均衡算法
    缓存类
    HTTP状态码100、200、300、400、500、600的含义
    Java中的多线程你只要看这一篇就够了(引用)
    An incompatible version 1.1.1 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17
    EL表达式与JSTL(C)标签
    JSP标准标签库
    SpringMVC HttpMessageConverter 匹配规则
    springboot学习(三)——使用HttpMessageConverter进行http序列化和反序列化
  • 原文地址:https://www.cnblogs.com/SUN-PH/p/4837490.html
Copyright © 2011-2022 走看看