ITPub博客

首页 > Linux操作系统 > Linux操作系统 > execute和fetch

execute和fetch

原创 Linux操作系统 作者:lsq_008 时间:2010-05-11 15:02:11 0 删除 编辑

关于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博客 ” ,链接:https://blog.itpub.net/10972173/viewspace-662437/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
十余年大型金融及电信系统数据库管理经验,曾服务于中国建设银行、中国移动。对oracle,mysql数据库有深入了解。 擅长python开发,独立开发了开源数据库自动化监控运维平台Power Monitor。

注册时间:2008-02-29

  • 博文量
    335
  • 访问量
    1369142