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_01\B19306_01\appdev.102\b14258\d_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,则会出现执行计划窗口。

 

转载于:https://www.cnblogs.com/Peyton-for-2012/p/3173117.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值