查看执行计划方法总结之一:explain plan命令

查看执行计划的方法有很多种,笔者今后将在博客里一一为大家介绍。本文介绍的是第一种方法,利用explain plan命令来查看执行计划。

1.用hr用户登录数据库
[oracle@ENMOEDU ~]$ sqlplus hr/oracle@ENMOEDU 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 10 00:11:00 2014
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

HR@ENMOEDU > 


2.使用explain plan命令
HR@ENMOEDU > explain plan for select salary from employees where first_name like 'Pat';

Explained.

3.查看执行计划
HR@ENMOEDU > select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------
Plan hash value: 3033625502
-------------------------------------------------------------------------------------------
| Id  | Operation                   | Name        | Rows  | Bytes | Cost (%CPU)|  Time     |
-------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |             |     1 |    11 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| EMPLOYEES   |     1 |    11 |     2   (0)|  00:00:01 |
|*  2 |   INDEX SKIP SCAN           | EMP_NAME_IX |     1 |       |     1   (0)|  00:00:01 |
-------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
   2 - access("FIRST_NAME"='Pat')
       filter("FIRST_NAME"='Pat')

15 rows selected.


至此,执行计划查看成功。

Frank

2014.04.09

--To be continued--
































来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29436907/viewspace-1139098/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29436907/viewspace-1139098/

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值