oracle 12c 新特性 Temporary UNDO

這個特性將對於臨時表的UNDO信息分離出去,獨立存儲在臨時表空間中,這就減少了對於UNDO段的使用。這個特性完全無損Oracle的事務一致性,但是卻得到了空間縮減的好處。

下面用實驗測試下效果:

SQL> show parameter temp_undo_enabled;
temp_undo_enabled                    boolean     FALSE
SQL> set autot traceonly statistics

SQL> create global temporary table test as select * from dba_tables where 1=0;

Table created.

SQL>  insert into test select * from dba_tables;

2108 rows created.


Statistics
----------------------------------------------------------
        782  recursive calls
        521  db block gets
      25061  consistent gets
          9  physical reads
      29384  redo size
        865  bytes sent via SQL*Net to client
        962  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
         22  sorts (memory)
          0  sorts (disk)
       2108  rows processed

SQL>  update test set table_name=lower(table_name);

2108 rows updated.


Statistics
----------------------------------------------------------
         12  recursive calls
       2742  db block gets
        355  consistent gets
          0  physical reads
     299640  redo size
        865  bytes sent via SQL*Net to client
        965  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
       2108  rows processed

SQL> conn / as sysdba
Connected.
SQL> alter session set temp_undo_enabled=true;

Session altered.

SQL> set autotrace traceonly statistics;    
SQL>  insert into test select * from dba_tables;

2108 rows created.


Statistics
----------------------------------------------------------
         25  recursive calls
        528  db block gets
      11812  consistent gets
          0  physical reads
        272  redo size
        850  bytes sent via SQL*Net to client
        962  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
          2  sorts (memory)
          0  sorts (disk)
       2108  rows processed

SQL>  update test set table_name=lower(table_name);

2108 rows updated.


Statistics
----------------------------------------------------------
          0  recursive calls
        129  db block gets
         97  consistent gets
          0  physical reads
          0  redo size
        857  bytes sent via SQL*Net to client
        965  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
       2108  rows processed

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章