update t_p_ds a
set isupdate = 1,
dwbh = (select dwbh
from t_p_dw
where ROWNUM < 2
and nsrbm = a.col002
and zzjgdm = replace(a.col004,'-',''))
where exists (select 1
from t_p_dw
where nsrbm = a.col002
and zzjgdm = replace(a.col004,'-',''))
and a.dwbh is null
and a.col002 is not null
and a.col004 is not null
and isupdate = 0
and rownum < 5000
--------------------------------
因为开始Update的时候3个小时没反应
所以想分段来更新添加了isupdate字段,默认为0更新后为1
以上语句在PL/SQL执行
第一次执行:80秒
第二次执行:142秒
第三次执行:228秒
第四次执行:288秒四次才更新到2W条,我数据库表里面有记录100W
如果按这样每一次都要加60秒,那要更新几天啊有什么办法
谢谢
set isupdate = 1,
dwbh = (select dwbh
from t_p_dw
where ROWNUM < 2
and nsrbm = a.col002
and zzjgdm = replace(a.col004,'-',''))
where exists (select 1
from t_p_dw
where nsrbm = a.col002
and zzjgdm = replace(a.col004,'-',''))
and a.dwbh is null
and a.col002 is not null
and a.col004 is not null
and isupdate = 0
and rownum < 5000
--------------------------------
因为开始Update的时候3个小时没反应
所以想分段来更新添加了isupdate字段,默认为0更新后为1
以上语句在PL/SQL执行
第一次执行:80秒
第二次执行:142秒
第三次执行:228秒
第四次执行:288秒四次才更新到2W条,我数据库表里面有记录100W
如果按这样每一次都要加60秒,那要更新几天啊有什么办法
谢谢
更新前面的数据时,读取的块少,所以快,越到后面,读取的数据块越多,
所以越来越慢!建议nsrbm加上索引,查看执行计划有没有使用上索引!!