• AUTOTRACE


    1.sqlplus
    设置参数 set atuotrace on
    SET AUTOTRACE OFF            --No AUTOTRACE report is generated. This is the default. 
    SET AUTOTRACE ON EXPLAIN     --The AUTOTRACE report shows only the optimizer execution path. 
    SET AUTOTRACE ON STATISTICS  --The AUTOTRACE report shows only the SQL statement execution statistics. 
    SET AUTOTRACE ON             --The AUTOTRACE report includes both the optimizer execution path and the SQL statement execution statistics. 
    SET AUTOTRACE TRACEONLY      --Like SET AUTOTRACE ON, but suppresses the printing of the user's query output, if any. If STATISTICS is enabled, query data is still fetched, but not printed. 
    
    然后执行语句
    在语句的结果后面会有执行计划。
    2.sqlplus
    使用DBMS_XPLAN包。
    详尽信息见10g官方文档B19306_01B19306_01appdev.10214258d_xplan.htm#sthref9740
    例子:
    示例:
    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM test;
    
    已解释。
    
    SQL> SET LINESIZE 130
    SQL> SET PAGESIZE 0
    SQL> SELECT * FROM table(DBMS_XPLAN.DISPLAY);
    Plan hash value: 1357081020
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |    16 |    48 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| TEST |    16 |    48 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    已选择8行。
    
    3.plsql developer
      在sql window 窗口写sql,然后按F5,则会出现执行计划窗口。
  • 相关阅读:
    做运维的感悟(做运维需要考虑事,运维组织结构,运维学习地图....)
    Go实现ssh执行远端命令及远程终端
    Go加密算法总结
    Vue项目上线环境部署,项目优化策略,生成打包报告,及上线相关配置
    博客园代码折叠
    win10关闭锁屏,直接进入登录界面

    多路查找树
    树结构的应用
    二叉树
  • 原文地址:https://www.cnblogs.com/Peyton-for-2012/p/3173117.html
Copyright © 2020-2023  润新知