设为首页 加入收藏

TOP

Oracle性能调整工具总结 (二)
2014-11-24 07:16:34 来源: 作者: 【 】 浏览:14
Tags:Oracle 性能 调整 工具 总结

查询路径—估算树

create table e

as select * from emp

create table d

as

select * from dept

Explain plan for

selectename,dname from d,e where e.deptno=d.deptno

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

Plan hash value: 1127375450

---------------------------------------------------------------------------

| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |

---------------------------------------------------------------------------

| 0 | SELECT STATEMENT | | 15 | 630 | 7 (15)| 00:00:01 |

|* 1 | HASH JOIN | | 15 | 630 | 7 (15)| 00:00:01 |

| 2 | TABLE ACCESS FULL| D | 4 | 88 | 3 (0)| 00:00:01 |

| 3 | TABLE ACCESS FULL| E | 15 | 300 | 3 (0)| 00:00:01 |

---------------------------------------------------------------------------

Predicate Information (identified byoperation id):

---------------------------------------------------

1 - access("E"."DEPTNO"="D"."DEPTNO")

Note

-----

- dynamic sampling used for this statement

Explain plan for

select ename,dnamefrom d, (select ename,deptno from e where rownum<2) e where e.deptno=d.deptno

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

Plan hash value: 1791846393

-----------------------------------------------------------------------------

| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |

-----------------------------------------------------------------------------

| 0 | SELECT STATEMENT | | 1 | 42 | 5 (0)| 00:00:01 |

| 1 | NESTEDLOOPS | | 1 | 42 | 5 (0)| 00:00:01 |

| 2 | VIEW | | 1 | 20 | 2 (0)| 00:00:01 |

|* 3 | COUNTSTOPKEY | | | | | |

| 4 | TABLE ACCESS FULL| E | 15 | 300 | 2 (0)| 00:00:01 |

|* 5 | TABLE ACCESS FULL | D | 1 | 22 | 3 (0)| 00:00:01 |

-----------------------------------------------------------------------------

Predicate Information (identified byoperation id):

---------------------------------------------------

3 - filter(ROWNUM<2)

5 -filter("E"."DEPTNO"="D"."DEPTNO")

Note

-----

- dynamic sampling used for this statement

驱动表概念

估算树

从左到右 从下到上

autotrace

oracle_home\sqlplus\admin\

conn sys/pwd@tiwen as sysdba;

drop role plustrace;

create role plustrace;

grant select on v_$sesstat to plustrace;

grant select on v_$statname to plustrace;

grant select on v_$mystat to plustrace;

grant plustrace to dba with admin option;

grant plustrace to public;

grant select on v_$sesstat to public;

grant select on v_$statname to public;

grant select on v_$mystat to public;

grant plustrace to dba with admin option;

grant plustrace to public;

grant alter session to public;

使用命令

set autotrace on

set autotrace off

set autotrace on explain

set autotrace on statistics

set autotrace traceonly

autotrace输出内容解释

recursive calls:执行语句时、调用的oracle内部语句(如分析所用的sql)和其他语句(如触发器)。

测试举例:

举例1

conn scott/tiger@tiwen

set autotrace on

alter system flush shared_pool

set autotrace on

select * from emp

select * from emp

举例2

首页 上一页 1 2 3 4 5 下一页 尾页 2/5/5
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Oracle性能调整的三把利剑--ASH,A.. 下一篇Oracle性能调整的要点之SGA

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis 分布式锁全解 (2025-12-25 17:19:51)
·SpringBoot 整合 Red (2025-12-25 17:19:48)
·MongoDB 索引 - 菜鸟 (2025-12-25 17:19:45)
·What Is Linux (2025-12-25 16:57:17)
·Linux小白必备:超全 (2025-12-25 16:57:14)