版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
测试目标:对比insert和delete产生的undo数量的多少
- 测试准备:
SQL> select count(*) from a;
COUNT(*)
----------
2761600
Elapsed: 00:00:00.20
SQL> select blocks*8/1024 size_m from dba_tables where table_name='A';
SIZE_M
----------
310.195313
测试1:删除数据
SQL> delete a;2761600 rows deleted.
Elapsed: 00:00:28.06
SELECT tablespace_name, status, SUM (bytes) / 1024 / 1024 "Bytes(M)"
FROM dba_undo_extents GROUP BY tablespace_name, status;
TABLESPACE_NAME STATUS Bytes(M)
------------------------------ --------- ----------
UNDOTBS1 ACTIVE 639.125
结论1:删除操作生成的undo是原数据的2倍。
测试2:插入数据
SQL> insert into b select * from a;2761600 rows created.
Elapsed: 00:00:08.02
TABLESPACE_NAME STATUS Bytes(M)
------------------------------ --------- ----------
UNDOTBS1 ACTIVE 11
结论2:插入操作生成的undo是原数据的3.5% 。