oracle绑定变量与非绑定变量的性能对比

create table t ( x int );

create or replace procedure proc1
as
begin
for i in 1 .. 10000
loop
execute immediate
'insert into t values ( :x )' using i;
end loop;
end;
 /

create or replace procedure proc2
as
begin
for i in 1 .. 10000
loop
execute immediate
'insert into t values ( '||i||')';
end loop;
end;
/
/* 这里用到的包在上一篇文章里 */

exec runstats_pkg.rs_start;
exec proc1;
exec runstats_pkg.rs_middle;
exec proc2;
exec runstats_pkg.rs_stop(10000);

Run2 ran in 723 cpu hsecs
run 1 ran in 20.06% of the time

Name                                  Run1        Run2        Diff
STAT...enqueue requests                 32      10,062      10,030
STAT...enqueue releases                 30      10,062      10,032
STAT...parse count (hard)                4      10,053      10,049
STAT...parse count (total)              11      10,061      10,050
STAT...consistent gets from ca          33      10,344      10,311
STAT...session logical reads        10,387      20,851      10,464
STAT...consistent gets from ca          55      10,581      10,526
STAT...consistent gets                  55      10,581      10,526
LATCH.cache buffers chains          51,092      61,884      10,792
LATCH.enqueue hash chains              135      20,383      20,248
LATCH.enqueues                         122      20,379      20,257
STAT...recursive calls              10,080      41,229      31,149
LATCH.kks stats                          9      57,015      57,006
LATCH.row cache objects                180      92,241      92,061
LATCH.shared pool simulator         20,125     172,276     152,151
LATCH.shared pool                   20,241     357,950     337,709
STAT...physical read total byt           0     598,016     598,016
STAT...physical read bytes               0     598,016     598,016

Run1 latches total versus runs -- difference and pct
Run1        Run2        Diff       Pct
92,892     789,588     696,696     11.76%

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

转载于:http://blog.itpub.net/12554513/viewspace-675150/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值