与hard parse对比测试;
scott@MWDB> create table t ( x int );
表已创建。
scott@MWDB> create or replace PRocedure proc1
2 as
3 begin
4 for i in 1 .. 10000
5 loop
6 execute immediate
7 'insert into t values ( :x )' using i;
8 end loop;
9 end;
10 /
过程已创建。
scott@MWDB> create or replace procedure proc2
2 as
3 begin
4 for i in 1 .. 10000
5 loop
6 execute immediate
7 'insert into t values ( 'i')';
8 end loop;
9 end;
10 /
过程已创建。
运行对比测试的小程序:
exec runstats_pkg.rs_start
exec proc1
exec runstats_pkg.rs_middle
exec proc2
exec runstats_pkg.rs_stop(1000)
测试结果:
Run1 ran in 180 hsecs
Run2 ran in 764 hsecs
run 1 ran in 23.56% of the time
Name Run1 Run2 Diff
STAT...recursive calls 10,124 12,243 2,119
STAT...redo size 2,316,668 2,310,452 -6,216
LATCH.cache buffers chains 73,789 81,264 7,475
STAT...parse count (hard) 2 10,014 10,012
LATCH.library cache pin 80,200 95,846 15,646
LATCH.library cache pin alloca 40,113 62,894 22,781
LATCH.session allocation 24 31,209 31,185
LATCH.row cache enqueue latch 112 41,612 41,500
LATCH.row cache objects 128 41,774 41,646
LATCH.child cursor hash table 18 70,980 70,962
LATCH.library cache 110,365 239,250 128,885
STAT...session pga memory 0 131,072 131,072
LATCH.shared pool 50,234 259,418 209,184
Run1 latches total versus runs -- difference and pct
Run1 Run2 Diff Pct
366,906 938,493 571,587 39.10%
PL/SQL 过程已成功完成。
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。