您的位置:首页 > 运维架构 > Linux

linux上利用源码搭建LAMP环境

2012-08-29 00:22 495 查看
undo就是前影像,delete要把一行所有的列都记录下来,UPDATE只记录一个列。补充一下insert基本上不产生回滚段的。
其实数据库里面消耗物理内存或者磁盘空间最小的单位是block,所以插入一行跟更新一行的某一列所占用undo space有可能是一致的,他们同样用了一个数据块。
DELETE FROM EMP WHERE EMPNO=7934;

删除了一整行的记录,这一行包括多个列,所以在undo中要记录这一行记录的原值,所以存储的信息是最多的
UPDATE EMP SET COMM=400 WHERE EMPNO=7844;

只是更新了一个列的值,undo中产生的记录也很少
INSERT INTO EMP VALUES(7999,'JHON','CLERK',7782,'10-MAY-83',1500,NULL,10);

在插入表记录的时候,undo中产生的记录只是个指针,说明新插入的是哪条记录,所以在undo中存储的信息很少

SG教材的原文中描述delete操作所需undo较大。

The number of bytes required to store information that is needed in case of rollback depends

on the type of transaction being performed:

Deletes are expensive for rollback segments; they need to store the actual row itself. If

you can use TRUNCATE instead, performance is improved.

Inserts use little rollback space; only the rowid is kept.

The amount used for updates depends on how many columns are being updated.

Indexed values generate more rollback, because the server process must change values

in the index as well as in the table. For updates on indexed columns, the Oracle server

records in the rollback segment the old data value, the old index value, and the new

index value. Updating rows that change partitions will also generate more rollback.

Direct path inserts / appends / loads are not likely to use much rollback.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: