CTAS和insert append的一個測試
該文章寫於2004年,最近剛從以前的blog上遷移出來。
8174上的一個測試,非歸檔模式:
程式碼:
SQL> select * from v$version;
BANNER ---------------------------------------------------------------- Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
PL/SQL Release 8.1.7.4.0 - Production
CORE 8.1.7.2.1 Production
TNS for 32-bit Windows: Version 8.1.7.4.0 - Production
NLSRTL Version 3.4.1.0.0 - Production
SQL> archive log list 資料庫日誌模式 非存檔模式
自動存檔 啟用
存檔終點 D:databaseoracleora817RDBMS
最早的概要資訊日誌序列 1488
當前日誌序列 1491
SQL> select * from redo_size;
VALUE ----------
91848
SQL> create table test nologging as select * from all_objects;
表已建立。
SQL> select * from redo_size;
VALUE ----------
147148
SQL> drop table test;
表已丟棄。
SQL> select * from redo_size;
VALUE ----------
177584
SQL> create table test as select * from all_objects;
表已建立。
SQL> select * from redo_size;
VALUE ----------
232892
SQL> select (232892 - 177584 ) redo,(147148-91848) redo_nolog from dual;
REDO REDO_NOLOG ---------- ----------
55308 55300 '
在歸檔模式下的情況:程式碼:
SQL> shutdown immediate; 資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup mount
ORACLE 例程已經啟動。
Total System Global Area 65648668 bytes
Fixed Size 75804 bytes
Variable Size 44523520 bytes
Database Buffers 20971520 bytes
Redo Buffers 77824 bytes
資料庫裝載完畢。
SQL> alter database archivelog
2 /
資料庫已更改。
SQL> alter database open;
資料庫已更改。
SQL> drop table test;
表已丟棄。
SQL> select * from redo_size;
VALUE ----------
30520
SQL> create table test as select * from all_objects;
表已建立。
SQL> select * from redo_size;
VALUE ----------
2953668
SQL> drop table test;
表已丟棄。
SQL> select * from redo_size;
VALUE ----------
3070020
SQL> create table test nologging as select * from all_objects;
表已建立。
SQL> select * from redo_size;
VALUE ----------
3125328
SQL> select (2953668-30520) redo,(3125328-3070020) redo_nolog from dual;
REDO REDO_NOLOG ---------- ----------
2923148 55308 '
在歸檔模式下的近一步測試,比較ctas和ctas無資料+ insert append 的redo size:程式碼:
SQL> drop table test;
表已丟棄。
SQL> select * from redo_size;
VALUE ----------
3155764
SQL> create table test as select * from all_objects where 1=0;
表已建立。
SQL> insert /*+append*/into test select * from all_objects;
已建立25474行。
SQL> commit;
提交完成。
SQL> select * from redo_size;
VALUE ----------
6079860
SQL> select (6079860-3155764) logging from dual;
(6079860-3155764)
-----------------
2924096
SQL> drop table test;
表已丟棄。
SQL> select * from redo_size;
VALUE ----------
6110356
SQL> create table test nologging as select * from all_objects where 1=0;
表已建立。
SQL> insert /*+append*/ into test select * from all_objects;
已建立25474行。
SQL> commit;
提交完成。
SQL> select * from redo_size;
VALUE ----------
6167588
SQL> select (6079860-3155764) logging ,(6167588-6110356)nologging from dual;
LOGGING NOLOGGING ---------- ----------
2924096 57232 '
根據這個結果,我們看到:
noarchivelog下的CTAS 的redo=noarchivelog下的CTAS nologging的redo =archivelog下的CTAS nologging的redo
這三種情況下,都對系統產生了較少的redo size
只有在archivelog 下CTAS,才產生了較多的redo size
比較了CTAS和CTAS+insert append後,實際上(archivelog mode):
CTAS nologging redo =CTAS(no data) nologing +insert append redo size;
CTAS redo =CTAS(no data) +insert append redo size;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29067253/viewspace-2121033/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 測試APPEND INSERT是否產生UNDO資訊的過程APP
- insert /*+ append */ into 與insert into 的區別APP
- nologging和insert /*+append*/APP
- Append與Direct-Path Insert(一)APP
- insert append需要注意的問題APP
- CTAS的一些特性
- insert /*+ append */直接路徑插入APP
- insert 中append 用法詳解APP
- 關於insert /* append */的幾點註記APP
- 關於insert /*+ append*/ 各種insert插入速度比較APP
- Append與Direct-Path Insert(二)APP
- 直接路徑插入 -- insert /*+append*/ into [zt]APP
- 歸檔模式下的 nologging和/*+ append */引數 效能測試模式APP
- 如何讓insert /*+ append */ 採用並行。APP並行
- 不同insert操作產生的undo的測試
- Direct Path Insert與APPEND, PARALLEL的梳理與小結APPParallel
- insert語句中append提示對欄位的檢查APP
- 【廖雪峰python入門筆記】list新增元素_append()和insert()Python筆記APP
- [Oracle] Append hint(insert sql) will lead a TM LOCKOracleAPPSQL
- insert /*+ append */於report unrecoverable命令實驗。APP
- SQLTest系列之INSERT語句測試SQL
- null ctasNull
- App測試、Web測試和介面測試一般測試流程APPWeb
- 自然連線的一個測試
- 表number列的資料插入insert小測試
- 對於一個 APP 測試和 web 測試應該有哪些成長呢!APPWeb
- oracle insert插入number(1)列的資料小測試Oracle
- 關於加快INSERT語句執行速度的測試
- 如何制定一個有效的測試策略
- 一個測試陣列用法的例子陣列
- ASM資料庫的一個測試ASM資料庫
- 關於加快INSERT語句執行速度和 HINT /*+ append*/及nologging的使用APP
- insert的時候使用append會不會影響到表的大小APP
- 簡單談一下我對持續測試下的測試左移、迭代測試和測試右移的理解吧
- 軟解析、硬解析的一個小測試
- 一個簡單的介面測試框架 demo框架
- 一個測試工程師的養成工程師
- Oracle 的 INSERT ALL和INSERT FIRSTOracle