Oracle 11g Advanced Compression(下)
下面如果使用一般的分條insert,壓縮效果如何呢?
SQL> truncate table t_compress;
Table truncated
SQL> declare
2 type t_list is table of t_ori%rowtype index by binary_integer;
3 i integer;
4
5 t_infos t_list;
6 begin
7 select *
8 bulk collect into t_infos
9 from t_ori;
10
11 for i in 1..t_infos.count loop
12 insert into T_COMPRESS values t_infos(i);
13
14 if (mod(i,1000)=0) then
15 commit;
16 end if;
17 end loop;
18
19 commit;
20 end;
21 /
PL/SQL procedure successfully completed
Executed in 18.703 seconds
SQL> select segment_name, count(*) extents, sum(blocks) blocks,sum(bytes)/1024/1024 MBs from dba_extents where wner='SYS' and segment_name in ('T_ORI','T_COMPRESS','T_COMPDIR') group by segment_name;
SEGMENT_NAME EXTENTS BLOCKS MBS
-------------------- ---------- ---------- ----------
T_COMPDIR 22 896 7
T_COMPRESS 37 2816 22
T_ORI 40 3200 25
Executed in 0.062 seconds
從現象上看,使用append資料表時和普通insert資料表在T_COMPRESS的時候空間差異不大。
下面我們來實驗使用compress for direct_load operations的時候,對其他操作影響。
SQL> alter system flush buffer_cache;
System altered
SQL> select count(*) from t_compress;
COUNT(*)
----------
217731
Executed in 0.094 seconds
SQL> select count(*) from t_compdir;
COUNT(*)
----------
217731
Executed in 0.063 seconds
SQL> select count(*) from t_ori;
COUNT(*)
----------
217731
Executed in 0.031 seconds
從查詢時間看,普通compress雖然可以大幅度減少空間使用,但是對其他操作的影響是存在的。
5、Compress For All Operation
Compress For All Operation選項是Advanced Compression的重要進步,提供了OLTP型別的壓縮操作。
SQL> create table t_compall compress for all operations as select * from t_ori where 1=0;
Table created
Executed in 0.157 seconds
SQL> create table t_compall2 compress for all operations as select * from t_ori;
Table created
Executed in 0.797 seconds
使用Compress for all operations子句就可以建立壓縮資料表。
SQL> insert /*+append */into t_compall select * from t_ori;
217731 rows inserted
Executed in 0.797 seconds
SQL> commit;
Commit complete
Executed in 0 seconds
SQL> select segment_name, count(*) extents, sum(blocks) blocks,sum(bytes)/1024/1024 MBs from dba_extents where wner='SYS' and segment_name in ('T_ORI','T_COMPALL','T_COMPALL2') group by segment_name;
SEGMENT_NAME EXTENTS BLOCKS MBS
-------------------- ---------- ---------- ----------
T_COMPALL2 23 1024 8
T_COMPALL 40 3200 25
T_ORI 40 3200 25
Executed in 0.797 seconds
同compress for direct_load operations現象基本類似。Append方式插入表現出一般的壓縮比例。
SQL> truncate table t_compall;
Table truncated
Executed in 0.047 seconds
SQL> declare
2 type t_list is table of t_ori%rowtype index by binary_integer;
3 i integer;
4
5 t_infos t_list;
6 begin
7 select *
8 bulk collect into t_infos
9 from t_ori;
10
11 for i in 1..t_infos.count loop
12 insert into t_compall values t_infos(i);
13
14 if (mod(i,1000)=0) then
15 commit;
16 end if;
17 end loop;
18
19 commit;
20 end;
21 /
PL/SQL procedure successfully completed
Executed in 17.687 seconds
SQL> select segment_name, count(*) extents, sum(blocks) blocks,sum(bytes)/1024/1024 MBs from dba_extents where wner='SYS' and segment_name in ('T_ORI','T_COMPALL','T_COMPALL2') group by segment_name;
SEGMENT_NAME EXTENTS BLOCKS MBS
-------------------- ---------- ---------- ----------
T_COMPALL2 23 1024 8
T_COMPALL 40 3200 25
T_ORI 40 3200 25
Executed in 0.313 seconds
6、結論
Oracle 11g推出的Advanced Compression特性是Oracle在資料壓縮方面的一個重要里程碑。它突出表現在兩個方面的優勢:其一是對OLTP系統各型別複雜操作的高效壓縮上,另一方面是體現在對RMAN、DataPump和Dataguard等多範圍壓縮支援上。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17203031/viewspace-707382/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g Advanced Compression(上)Oracle
- Oracle Database Compression 2 - Advanced/OLTP CompressionOracleDatabase
- Advanced Index CompressionIndex
- Oracle Database Compression 1 - Basic CompressionOracleDatabase
- Oracle Database 11g 第2版中的 Oracle Advanced SecurityOracleDatabase
- Oracle Database Compression 3 - Hybrid Columnar CompressionOracleDatabase
- Oracle Advanced SecurityOracle
- zt:Different type of RMAN backup compression in 11G
- [20181127]12c Advanced Index Compression.txtIndex
- [20181127]12c Advanced Index Compression 2.txtIndex
- [20190311]12cR2 Advanced index compression.txtIndex
- Oracle Index Key Compression索引壓縮OracleIndex索引
- Oracle 11g提供下載Oracle
- Oracle Advanced Security Frequently Asked QuestionsOracle
- Oracle Advanced Performance Tuning ScriptsOracleORM
- Oracle Advanced Performance Tuning Scripts(轉)OracleORM
- 10G、11G expdp的compression引數的區別
- Unused Block Compression和Null Block CompressionBloCNull
- linux下安裝oracle 11gLinuxOracle
- 刪除AIX下的ORACLE 11gAIOracle
- Oracle 11g DRCP配置與使用(下)Oracle
- CentOS 7下安裝Oracle 11gCentOSOracle
- oracle10g,11g中的exp,expdp引數compress, compression完全不同的定義Oracle
- 在Oracle Linux 6.6下安裝Oracle 11gOracleLinux
- oracle linux 下安裝oracle 11g問題OracleLinux
- oracle 10g advanced replication of basic multimasterOracle 10gAST
- Oracle Hybrid Columnar Compression(HCC) 混合列壓縮Oracle
- Oracle 表壓縮(Table Compression)技術介紹Oracle
- Oracle OCP 1Z0-053(Rman Compression Algorithm)OracleGo
- 聊聊Oracle 11g中的Reference Partition(下)Oracle
- Windows下Oracle 11G記憶體修改WindowsOracle記憶體
- Oracle 高階佇列(AQ Advanced Queueing)Oracle佇列
- OEL6下ORACLE 11g手工建庫Oracle
- Linux下Oracle 11g靜默安裝LinuxOracle
- 在oracle 11g下安裝配置scheduler agentOracle
- oracle linux 下安裝OGG 11gOracleLinux
- 聊聊Oracle 11g的Snapshot Standby Database(下)OracleDatabase
- 【EXPDP】11g版本EXPDP 的COMPRESSION引數壓縮比堪比“gzip -9”