设为首页 加入收藏

TOP

用TKPROF工具查看trace文件(二)
2014-11-23 21:28:03 】 浏览:338
Tags:TKPROF 工具 查看 trace 文件
******************************
UPDATE TEST_EMP SET SAL = '1000'
WHERE
EMPNO=:B1
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 632 0.01 0.02 0 1897 18 14
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 633 0.01 0.02 0 1897 18 14
可以看出,对整个语句解析了一次,执行了一次,对更新语句解析了一次,执行了632次,这里就体现了语句的重用,在应用中如果重用多的话,就会避免大量的硬解析,那么会大大提高 数据库的性能
接下来研究通过execute immediate命令是用动态SQL来做同样的事情
[ html]
begin
for i in 7369..8000
loop
execute immediate 'update test_emp set sal = 2000 where empno='||i;
end loop;
end;
查看trace文件,可以看到,
[html]
begin
for i in 7369..8000
loop
execute immediate 'update test_emp set sal = 1000 where empno='||i;
end loop;
end;
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.07 0.07 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.08 0.08 0 0 0 1
这个程序块被解析了1次,执行的一次,但是更新语句却被解析了632次
[html]
********************************************************************************
update test_emp set sal = 1000
where
empno=7369
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.01 0.01 0 2 0 0
Execute 1 0.00 0.00 0 3 3 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.01 0.01 0 5 3 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 54 (recursive depth: 1)
Rows Row Source Operation
------- ---------------------------------------------------
0 UPDATE TEST_EMP (cr=3 pr=0 pw=0 time=233 us)
1 TABLE ACCESS FULL TEST_EMP (cr=3 pr=0 pw=0 time=58 us)
********************************************************************************
update test_emp set sal = 1000
where
empno=7370
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 1 0 0
Execute 1 0.00 0.00 0 3 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 4 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 54 (recursi
首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇ETL工具VSSQL整理 下一篇SQL Server中的服务、工具、组件..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目