插入相同的資料量普通表和臨時表產生的redo對比
SQL> create table t_heap tablespace users as select * from dba_objects where 1=2;
Table created.
SQL> create global temporary table t_temp on commit preserve rows as select * from dba_objects where 1=2;
Table created.
SQL> select a.name,b.value,b.sid from v$statname a ,v$sesstat b where a.STATISTIC# in (133,134)
2 and a.STATISTIC#=b.STATISTIC# and b.sid=(select distinct sid from v$mystat);
NAME VALUE SID
------------------------------ ---------- ----------
redo entries 140 138
redo size 35552 138
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> insert into t_heap select * from dba_objects;
11376 rows created.
SQL> commit;
Commit complete.
SQL> select a.name,b.value,b.sid from v$statname a ,v$sesstat b where a.STATISTIC# in (133,134)
2 and a.STATISTIC#=b.STATISTIC# and b.sid=(select distinct sid from v$mystat);
NAME VALUE SID
------------------------------ ---------- ----------
redo entries 8493 138
redo size 11837876 138
SQL> select 11837876 - 35552 from dual;
11837876-35552
--------------
11802324
--在普通表裡插入113760條資料產生的日誌是11802324位元組的日誌
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
SQL> select a.name,b.value,b.sid from v$statname a ,v$sesstat b where a.STATISTIC# in (133,134)
2 and a.STATISTIC#=b.STATISTIC# and b.sid=(select distinct sid from v$mystat);
NAME VALUE SID
------------------------------ ---------- ----------
redo entries 8493 138
redo size 11837876 138
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> insert into t_temp select * from dba_objects;
11376 rows created.
SQL> commit;
Commit complete.
SQL> select a.name,b.value,b.sid from v$statname a ,v$sesstat b where a.STATISTIC# in (133,134)
2 and a.STATISTIC#=b.STATISTIC# and b.sid=(select distinct sid from v$mystat);
NAME VALUE SID
------------------------------ ---------- ----------
redo entries 11157 138
redo size 12427444 138
SQL> select 12427444 - 11837876 from dual;
12427444-11837876
-----------------
589568
--在臨時表裡插入113760條資料產生的日誌是589568位元組的日誌
SQL> select 11802324 - 589568 from dual;
11802324-589568
---------------
11212756
SQL> select (11802324 - 589568)/1024/1024 m from dual;
M
----------
10.6933174
結論:插入相同的資料量到普通表和臨時表redo相差10m多...
SQL> select count(*) from t_heap;
COUNT(*)
----------
113760
SQL> select count(*) from t_temp;
COUNT(*)
----------
113760
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1043541/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 9i臨時表產生過多redoOracle
- 線上非rman備份產生和普通操作產生的redo大小比較
- 臨時表的APPEND方式插入APP
- TempDB 中表變數和區域性臨時表的對比變數
- ORACLE臨時表和SQLSERVER臨時表異同OracleSQLServer
- goldengate對oracle臨時表的同步GoOracle
- 記憶體表和臨時表的區別記憶體
- SQL Server中的臨時表和表變數SQLServer變數
- MySQL5.6 5.7使用者臨時表 對比MySql
- Oracle的臨時表Oracle
- 臨時表的操作
- MySql 儲存過程 臨時表 無法插入資料MySql儲存過程
- MySQL單表存多大的資料量比較合適MySql
- 【基礎知識】基於事物的臨時表和基於會話的臨時表會話
- 再議臨時表和表變數變數
- mysql臨時表和記憶體表MySql記憶體
- Oracle 基礎 ----臨時表和物件表Oracle物件
- ORACLE Temporary Tables臨時表更適合做插入和查詢操作Oracle
- Sqlserver 關於臨時表和表變數的總結SQLServer變數
- oracle 臨時表的使用Oracle
- MySQL 中的臨時表MySql
- SQLServer臨時表的使用SQLServer
- oracle臨時表的用法Oracle
- 大資料量下MySQL插入方法的效能比較大資料MySql
- 建立基於事務和基於會話的臨時表及臨時表建索引的實驗會話索引
- mysql的內部臨時表MySql
- oracle的臨時表空間Oracle
- SQL SERVER臨時表的使用SQLServer
- mysql臨時表的問題MySql
- oracle臨時表的用法(轉)Oracle
- SQL server 中的臨時表SQLServer
- Redo wastage產生的原因AST
- MySQL臨時表MySql
- PostgreSQL:臨時表SQL
- oracle臨時表Oracle
- Oracle 臨時表Oracle
- 通過append hint來插入資料,演示它和普通插入資料的效能比較。APP
- Oracle臨時表空間檢視、新增臨時表空間資料檔案、修改預設臨時表空間 方法!Oracle