ITPub博客

首页 > Linux操作系统 > Linux操作系统 > commit 时间的测试

commit 时间的测试

原创 Linux操作系统 作者:huazhongenjoy 时间:2013-01-14 18:34:39 0 删除 编辑

 准备工作:
 create table t as select * from all_objects ;
 
 1: 一次commit;
  declare
    vn_count int ;
  begin
      vn_count := dbms_utility.get_cpu_time;
      update t
      set CREATED = sysdate;   
      commit;
      dbms_output.put_line(dbms_utility.get_cpu_time-vn_count||'ms');
  end ;
 out:  35ms
 
 
 2: 分批次commit ;
   declare                                                           
       vn_count int ;                                                
       nn          number(10);                                       
       cursor cur_1 is                                               
         select rowid row_id,t.* from t t;                           
   begin                                                             
       vn_count := dbms_utility.get_cpu_time;                        
       for vc_cur in cur_1 loop                                      
           update t                                                  
           set created = sysdate                                     
           where rowid = vc_cur.row_id;                              
           nn := nn+1;                                               
           if nn > 100 then                                          
               commit;                                               
               nn  := 0;                                             
           end if;                                                   
       end loop;                                                     
       commit;                                                       
       dbms_output.put_line(dbms_utility.get_cpu_time-vn_count||'ms');
   end ;     
          
  out:   146ms
                                               
分批次更新之所以执行的时间比较长感觉是因为产生了一致性读   

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

上一篇: 没有了~
下一篇: 高水位线
请登录后发表评论 登录
全部评论

注册时间:2011-01-24

  • 博文量
    2
  • 访问量
    4221

最新文章