對比insert和delete操作產生的undo
阿新 • • 發佈:2019-02-06
測試目標:對比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% 。