关于execute和fetch这两个阶段,到底是怎么区分的,一直感到迷惑,做个测试,可以大概看个明白:
SQL> alter session set events '10046 trace name context forever,level 12';
Session altered.
SQL> select count(*) from t1;
COUNT(*)
----------
651001
SQL> select count(*) from t1;
COUNT(*)
----------
651001
SQL> insert into t1 select * from t1 where rownum<=10000;
10000 rows created.
insert into t1 select from t1 where rownum=10000
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.02 0 0 0 0
Execute 1 1.47 5.04 6512 7998 29743 10000
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 1.47 5.06 6512 7998 29743 10000
select count(*)
from
t1
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 8.57 9.03 115 26041 1 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 8.58 9.04 115 26041 1 2
可见,对于dml操作,真正的执行就是在execute阶段,而对于select操作,真正的执行应该是fetch阶段。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10972173/viewspace-662437/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10972173/viewspace-662437/