Oracle 更新超大表

 250w數據15秒


declare
  maxrows      number default 5000;
  row_id_table dbms_sql.Urowid_Table;
  p_id_table   dbms_sql.Varchar2_Table;
  cursor acnt_first_cur is
    select /*+ use_hash(t1) parallel(t1,8) */
     t1.key, t1.rowid
      from t_file_chunk_manage t1
     order by t1.rowid;
begin
  open acnt_first_cur;
  loop
    exit when acnt_first_cur%notfound;
    fetch acnt_first_cur bulk collect
      into p_id_table, row_id_table limit maxrows;
    forall i in 1 .. row_id_table.count
      update t_file_chunk_manage
         set file_simple_md5 = p_id_table(i)
       where rowid = row_id_table(i);
    commit;
  end loop;
end;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章