oracle 的表壓縮
Table compression was introduced in Oracle 9i as a space saving feature for data warehousing projects. In 11g it is now considered a mainstream feature that is acceptable for OLTP databases. In addition to saving storage space, compression can result in increased I/O performance and reduced memory use in the buffer cache. These advantages do come at a cost, since compression incurs a CPU overhead, so it won't be of benefit to everyone.
Oracle 表壓縮有表空間級別、 表或分割槽級別:
-
NOCOMPRESS - 表和分割槽不進行壓縮。 在不進行任何指定情況下預設建表不會進行壓縮。
-
COMPRESS - 這個選項適用於資料倉儲系統。 表或分割槽在進行direct-path 插入時會進行壓縮。
-
COMPRESS FOR DIRECT_LOAD OPERATIONS - 這個和COMPRESS 的功能一樣。
-
COMPRESS FOR ALL OPERATIONS - 這個選項使用於OLTP 系統。 這個選項會為所有的操作進行壓縮,包括常規的DML操作。此選項要11.1.0 或更高版本。 在11gR2 中此選項重新命名為COMPRESS FOR OLTP。
Table 級別和Partition級別的壓縮示例:
-- Table compression.
create table test_tab_1(
id number(10) not null,
description varchar2(50) not null,
create_date date not null
)
compress for all operations;
--Partition level compression.
create table test_tab_2(
id number(10) not null,
description varchar2(50) not null,
create_date date not null
)
partition by range (create_date)(
partition test_tab_q1 values less than (to_date('01/01/2018','DD/MM/YYYY')) compress,
partition test_tab_q2 values less than (to_date('01/04/2018','DD/MM/YYYY')) COMPRESS FOR DIRECT_LOAD OPERATIONS,
partition test_tab_q3 values less than (to_date('01/07/2018','DD/MM/YYYY')) compress for all operations,
partition test_tab_q4 values less than (maxvalue) nocompress
);
表級別的壓縮可以透過[DBA|ALL|USER]_TABLES 檢視去查詢,對於分割槽表不會有顯示是否進行了壓縮。
select table_name,compression,compress_for from user_tables;
分割槽級別的壓縮可以透過[DBA|ALL|USER]_TAB_PARTITIONS 檢視。
select table_name,partition_name,compression,compress_for from user_tab_partitions;
對於表和分割槽的壓縮設定可以透過alter table 命令去修改。 這種改變對現有的資料無影響,僅對新的操作有效。
alter table test_tab_1 nocompress;
alter table test_tab_2 modify partition test_tab_q4 compress for all operations;
表壓縮的限制:
The restrictions associated with table compression include:
- Compressed tables can only have columns added or dropped if the
COMPRESS FOR ALL OPERATIONS
option was used. - Compressed tables must not have more than 255 columns.
- Compression is not applied to lob segments.
- Table compression is only valid for heap organized tables, not index organized tables.
- The compression clause cannot be applied to hash or hash-list partitions. Instead, they must inherit their compression settings from the tablespace, table or partition settings.
- Table compression cannot be specified for external or clustered tables.
參考連結:
~:text=Table%20compression%20was%20introduced%20in%20Oracle%209i%20as,and%20reduced%20memory%20use%20in%20the%20buffer%20cache.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21374452/viewspace-2771947/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle表的壓縮Oracle
- Oracle表壓縮Oracle
- oracle 表壓縮Oracle
- oracle壓縮表(一)Oracle
- oracle壓縮表(二)Oracle
- Oracle壓縮黑科技(一)—基礎表壓縮Oracle
- oracle (11gR2)中的表壓縮Oracle
- ORACLE 壓縮Oracle
- oracle 11g 新特性 表壓縮Oracle
- MySQL 5.6的表壓縮MySql
- Oracle壓縮黑科技(二)—壓縮資料的修改Oracle
- oracle10g表壓縮後的效率比對Oracle
- oracle 索引壓縮Oracle索引
- 表壓縮技術
- OGG Oracle 分割槽壓縮表 到 MySQL分表的實現OracleMySql
- Oracle 表壓縮(Table Compression)技術介紹Oracle
- oracle 11g對於表壓縮改進Oracle
- oracle壓縮技術Oracle
- Oracle資料壓縮Oracle
- ORACLE備份中的壓縮Oracle
- MYSQL壓縮表測試MySql
- Sqlserver表和索引壓縮SQLServer索引
- 【表壓縮】使用表壓縮技術將表所佔用空間降低到最小
- 字串的壓縮和解壓縮字串
- SQL Server 2008 表和索引的行壓縮和頁壓縮SQLServer索引
- MySQL壓縮表的一種應用MySql
- Oracle——EXPDP加密和壓縮Oracle加密
- oracle壓縮表表空間Oracle
- myisampack工具(MyISAM表壓縮工具)
- 簡單的zip壓縮和解壓縮
- Nginx網路壓縮 CSS壓縮 圖片壓縮 JSON壓縮NginxCSSJSON
- JAVA壓縮和解壓縮Java
- zip壓縮和解壓縮
- MySQL實現MYISAM表批次壓縮的方法MySql
- 大資料時代的壓縮表現形式大資料
- Oracle 10g資料表壓縮的一些細節(上)Oracle 10g
- Oracle 10g資料表壓縮的一些細節(下)Oracle 10g
- oracle 壓縮技術(compress)Oracle