楼主: fromeast

利用rowid快速在线更新海量数据

[复制链接]
论坛徽章:
24
数据库板块每日发贴之星
日期:2006-11-05 01:02:00祖国60周年纪念徽章
日期:2009-10-09 08:28:00祖国60周年纪念徽章
日期:2009-10-09 21:00:44ITPUB8周年纪念徽章
日期:2009-10-09 21:31:082010新春纪念徽章
日期:2010-01-04 08:33:082010新春纪念徽章
日期:2010-03-01 11:04:54ITPUB9周年纪念徽章
日期:2010-10-08 09:31:222011新春纪念徽章
日期:2011-02-18 11:42:472012新春纪念徽章
日期:2012-01-04 11:50:44ITPUB 11周年纪念徽章
日期:2012-10-09 18:06:20
171#
发表于 2009-9-25 10:24 | 只看该作者
很不错,很多技术都考虑的,各有各的好处和不足

使用道具 举报

回复
招聘 : 数据库管理员
论坛徽章:
20
祖国60周年纪念徽章
日期:2009-10-09 08:28:00数据库板块每日发贴之星
日期:2011-02-20 01:01:01ITPUB季度 技术新星
日期:2011-04-02 10:31:09ITPUB十周年纪念徽章
日期:2011-11-01 16:24:042012新春纪念徽章
日期:2012-01-04 11:54:26玉石琵琶
日期:2012-02-21 15:04:38最佳人气徽章
日期:2012-03-13 17:39:18ITPUB 11周年纪念徽章
日期:2012-10-09 18:09:192013年新春福章
日期:2013-02-25 14:51:242011新春纪念徽章
日期:2011-02-18 11:43:33
172#
发表于 2009-9-25 10:51 | 只看该作者
看了这文章 感觉自己是在太菜了

使用道具 举报

回复
论坛徽章:
9
ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44生肖徽章2007版:鸡
日期:2008-01-02 17:35:53生肖徽章2007版:鼠
日期:2008-01-02 17:35:53生肖徽章2007版:猪
日期:2009-03-10 21:17:25生肖徽章2007版:猴
日期:2009-03-10 21:23:27生肖徽章2007版:牛
日期:2009-03-10 21:26:49生肖徽章2007版:鸡
日期:2009-03-10 21:36:09ITPUB8周年纪念徽章
日期:2009-09-27 10:21:22祖国60周年纪念徽章
日期:2009-10-09 08:28:00
173#
发表于 2009-9-26 18:50 | 只看该作者
方法不错,可以试试用不同的Hints,或用Bulk collect 的方式来测试一下

使用道具 举报

回复
论坛徽章:
4
174#
发表于 2009-9-26 22:20 | 只看该作者
不错哦!

使用道具 举报

回复
论坛徽章:
0
175#
发表于 2009-9-27 08:29 | 只看该作者
前面几位高手,后面怎么都熄火了。。
特别是老和尚。。

使用道具 举报

回复
论坛徽章:
40
技术图书徽章
日期:2023-02-28 10:16:02暖羊羊
日期:2015-02-10 17:19:24马上有房
日期:2015-01-12 10:57:17ITPUB社区OCM联盟徽章
日期:2014-08-27 17:33:52青年奥林匹克运动会-帆船
日期:2014-08-27 13:50:412014年世界杯参赛球队: 哥伦比亚
日期:2014-07-10 14:10:592014年世界杯参赛球队:墨西哥
日期:2014-06-24 10:38:072014年世界杯参赛球队: 加纳
日期:2014-06-23 13:12:032014年世界杯参赛球队: 美国
日期:2014-05-21 08:18:36沸羊羊
日期:2015-03-04 14:51:52
176#
发表于 2009-10-13 10:45 | 只看该作者
不错借鉴经验

使用道具 举报

回复
论坛徽章:
5
2010广州亚运会纪念徽章:篮球
日期:2010-11-29 10:28:582010广州亚运会纪念徽章:帆船
日期:2010-11-29 11:24:34生肖徽章2007版:兔
日期:2011-01-20 12:58:49ITPUB官方微博粉丝徽章
日期:2011-07-04 09:42:06ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51
177#
发表于 2009-12-1 21:58 | 只看该作者
在asktom上看到如下一段文字,指专门讨论大表更新问题的:
不知道大家是怎么看的,到底order rowid真正起作用了吗?

http://asktom.oracle.com/pls/ask ... 2330#21410664830973

please refer "How to update part of a Very Large Table  July 28, 2003"

When updating a large table in a database having comparatively less buffer cache one thing to make
sure is that blocks are updated in a continuous order. Suppose some records of block1 is updated
first in the beginning and next after updating some other blocks, then block1 will be written twice
by DBWR and LGWR. After the first update block1 may get flushed out by LRU algorithm. If all
records in block1 is updated at a time then block1 is wriiten by LGWR and DBWR only once. If the
update statement is doing a full table scan then bloacks are updated in order. But the order can be
different when the is using an index for selecting the rows.

The SQL statement that makes sure of that is

update (select id, description from test_update where rowid in(select rowid from (select rowid from
test_update order by rowid))) set description=description||' new val' where description like '%5%';





Followup   August 28, 2003 - 7am Central time zone:

not necessarily so -- first lgwr doesn't write blocks -- it writes redo.  second, dbwr may or may
not write the block more then once.


I would never never never use your approach.  why I would want to

a) read the entire table
b) sort the rowids
c) distinct that set (implied)
d) join to it (and you are making the assumption the table in the IN will be the driving table and
that a hash join will not be used and ..... lots of other stuff)



when a simple:

update T set d = d || 'x' where d like '%5%'

will do it -- if you are worried about the index on d being used - you would simply FULL hint it --
but doubtful that it would be necessary.

the additional work you add would more then offset the work you are trying to save.

使用道具 举报

回复
论坛徽章:
102
现任管理团队成员
日期:2011-05-07 01:45:08ITPUB十周年纪念徽章
日期:2012-11-26 16:33:25慢羊羊
日期:2015-03-04 14:19:442015年新春福章
日期:2015-03-06 11:57:312016猴年福章
日期:2016-02-23 09:58:34
178#
发表于 2010-1-20 10:51 | 只看该作者
和尚还没公布他的解决办法啊

使用道具 举报

回复
论坛徽章:
10
ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44ITPUB十周年纪念徽章
日期:2011-11-01 16:21:152011新春纪念徽章
日期:2011-05-06 16:49:002011新春纪念徽章
日期:2011-02-18 11:43:33ITPUB9周年纪念徽章
日期:2010-10-08 09:28:512010新春纪念徽章
日期:2010-03-01 11:07:22生肖徽章2007版:鸡
日期:2009-09-28 12:51:472009新春纪念徽章
日期:2009-01-04 14:52:28生肖徽章2007版:鼠
日期:2008-01-02 17:35:53劳斯莱斯
日期:2013-12-16 10:42:54
179#
发表于 2010-1-20 12:19 | 只看该作者
跟踪!

使用道具 举报

回复
论坛徽章:
1
2010新春纪念徽章
日期:2010-03-01 11:20:05
180#
发表于 2010-1-27 18:48 | 只看该作者
学习了。。。
有点高深。。。、
呵呵

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表