性能比较 动态和非动态 绑定和非绑定

CREATE TABLE TEST(X INT, Y INT ,z INT) ;

create or replace procedure proc1
as
begin
for i in 1..10000
loop
execute immediate ' insert into test1 values ( :x ,:y,:z) ' using i ,i,i;
commit ;
end loop;
end;

create or replace procedure proc3
as
begin
for i in 1..10000
loop
insert into test1 values (i,i,i);
end loop;
commit ;
end ;
我也来说两句 查看全部回复

最新回复

  • lijun3721 (2008-12-03 16:45:03)

    比较

    cSQL> set timing on
    SQL> exec proc1

    PL/SQL procedure successfully completed

    Executed in 1.016 seconds

    SQL> exec proc3

    PL/SQL procedure successfully completed

    Executed in 0.75 seconds
  • lijun3721 (2008-12-03 16:51:48)

    LATCH.simulator lru latch            4,285         434      -3,851
    LATCH.simulator hash latch           4,300         449      -3,851
    LATCH.messages                       4,694          11      -4,683
    STAT...deferred (CURRENT) bloc       5,011           3      -5,008
    LATCH.redo writing                   6,937           9      -6,928
    STAT...session uga memory                0       7,488       7,488
    STAT...table scan rows gotten        8,702           0      -8,702
    STAT...IMU commits                   9,906           0      -9,906
    STAT...calls to kcmgas              10,011          82      -9,929
    STAT...commit cleanouts             10,006          29      -9,977
    STAT...commit cleanouts succes      10,002          25      -9,977
    STAT...user commits                 10,000           1      -9,999
    LATCH.compile environment latc      10,001           1     -10,000
    LATCH.session idle bit              10,037          37     -10,000
    STAT...calls to get snapshot s      10,035           5     -10,030
    LATCH.enqueues                      10,054           1     -10,053
    STAT...IMU Redo allocation siz      29,936      11,036     -18,900
    LATCH.dml lock allocation           20,006           4     -20,002
    STAT...enqueue requests             20,026           3     -20,023
    STAT...enqueue releases             20,027           3     -20,024
    LATCH.library cache pin             40,090      20,065     -20,025
    STAT...db block changes             40,262      20,204     -20,058
    STAT...recursive calls              30,082      10,003     -20,079
    LATCH.session allocation            20,162           2     -20,160
    LATCH.redo allocation               26,939          11     -26,928
    STAT...db block gets from cach      40,279      10,328     -29,951
    STAT...db block gets                40,279      10,328     -29,951
    LATCH.library cache                 50,125      20,094     -30,031