ta compressed with the COMPRESS FOR QUERY HIGH option.
?
The COMPRESS FOR ARCHIVE LOW option is the default archive compression mode. It provides a high compression level and is ideal for infrequently-accessed data. The COMPRESS FOR ARCHIVE HIGH option should be used for data that is rarely accessed.
A compression advisor, provided by the DBMS_COMPRESSION package, helps you determine the expected compression level for a particular table with a particular compression method.
Note:
Hybrid Columnar Compression is dependent on the underlying storage system. See
Oracle Database Licensing Information for more information.
See Also:
Oracle Database Concepts for an overview of table compression
"Compressed Tablespaces"
Examples Related to Table Compression
The following examples are related to table compression:
Example 20-1, "Creating a Table with OLTP Table Compression"
Example 20-2, "Creating a Table with Basic Table Compression"
Example 20-3, "Using Direct-Path Insert to Insert Rows Into a Table"
Example 20-4, "Creating a Table with Warehouse Compression"
Example 20-5, "Creating a Table with Archive Compression"
Example 20-1 Creating a Table with OLTP Table Compression
##新建一个oltp类型的压缩表
The following example enables OLTP table compression on the table orders:
CREATE TABLE orders ... COMPRESS FOR OLTP;
Data for the orders table is compressed during both direct-path INSERT and conventional DML.
##此种压缩方式下,直接路径插入和传统路径插入的数据都会被压缩。
Example 20-2 Creating a Table with Basic Table Compression
##新建一个basic类型的压缩表
The following statements, which are equivalent, enable basic table compression on the sales_history table, which is a fact table in a data warehouse:
CREATE TABLE sales_history ... COMPRESS BASIC;
CREATE TABLE sales_history ... COMPRESS;
Frequent queries are run against this table, but no DML is expected.
##这种压缩方式一般被用在频繁查询,但不被dml的表上
Example 20-3 Using Direct-Path Insert to Insert Rows Into a Table
This example demonstrates using the APPEND hint to insert rows into the sales_history table using direct-path INSERT.
##使用append提示符激活直接路径插入
INSERT /*+ APPEND */ INTO sales_history SELECT * FROM sales WHERE cust_id=8890;
COMMIT;
Example 20-4 Creating a Table with Warehouse Compression
This example enables Hybrid Columnar Compression on the table sales_history:
CREATE TABLE sales_history ... COMPRESS FOR QUERY;
The table is created with the default COMPRESS FOR QUERY HIGH option. This option provides a higher level of compression than basic or OLTP compression. It works well when load performance is critical, frequent queries are run against this table, and no DML is expected.
Example 20-5 Creating a Table with Archive Compression
The following example enables Hybrid Columnar Compression on the table sales_history:
CREATE TABLE sales_history ... COMPRESS FOR ARCHIVE;
The table is created with the default COMPRESS FOR ARCHIVE LOW option. This option provides the highest level of compression and works well for infrequently-accessed data.
Compression and Partitioned Tables
A table can have both compressed and uncompressed partitions, and different partitions can use different compression methods. If the compression settings for a table and one of its partitions do not match, then the partition setting has precedence for the partition.
##一个分区表可以同时包含压缩的和非压缩的分区,并且可以给压缩分区指定不同的压缩方式。我们可以给分区表以及分区指定不同的分区方式,并且分区上的指定具有较高的优先级。
To change the compression method for a partition, do one