Delete,insert,update与undo的关系[转载TOM文章]

本文探讨了SQL操作(包括DELETE、INSERT与UPDATE)与Undo记录之间的关系。在一般情况下,DELETE操作产生的Undo最多,INSERT最少。文章还分析了索引对Undo生成的影响,并提供了实例说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Delete,insert,update与undo的关系

What is relationship (delete,insert,update) and undo?


during an insert - we have togenerate undo equivalent to "delete+rowid" 
during an update - we have togenerate undo equivalent to "update this rowid to have thesebefore image values" (undo = rowid + column before images) 
during a delete - we have togenerate undo equivalent to "insert at this rowid thesevalues" 
so,considering an unindexed table - IN GENERAL, a delete and update will generatethe most and an insert the least. IN GENERAL this is true (but not always). 
INGENERAL=>delete>update>insert

if you add indexes - everything canchange. the insert might generate gobs of undo for the index maintenance -the update might not update any indexed columns and hence only generate undofor the table - and the delete might have to maintain all of the indexesgenerating tons of undo again. 
so, it depends on the nature of the data,what you are inserting/updating/deleting.. 
same for redo. It depends on what is modified... 

Add indexes

IN GENERAL=>delete>insert>update

 

 

总结:

通常情况下

Undo 产生量排序:delete>update>insert

Undo(table of indexes)产生量排序:delete>insert>update

一些手机发送业务上,往往会使用update去更新业务的状态!

 

转载TOM的文章:

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5663330700346736253

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值