Oracle Schema Objects

Table Compression

表压缩

The database can use table compression to reduce the amount of storage required for the table.

数据库可以使用表压缩来消除数据块中的重复值。

Compression saves disk space, reduces memory use in the database buffer cache, and in some cases speeds query execution. Table compression is transparent to database applications.

对于数据高度冗余的表,压缩可以节省磁盘空间,减少数据库高速缓存中的内存使用,并在某些情况下可以加快查询执行速度。表压缩对数据库应用程序是透明的。

Basic and OLTP Table Compression

基本/OLTP

Dictionary-based table compression provides good compression ratios for heap-organized tables. Oracle Database supports the following types of dictionary-based table compression:

基于字典的表压缩提供了很好的压缩率。Oracle 数据库支持以下类型的表压缩:

Basic table compression

基本表压缩

This type of compression is intended for bulk load operations. The database does not compress data modified using conventional DML. You must use direct path loads, ALTER TABLE . . . MOVE operations, or online table redefinition to achieve basic compression.

这种类型的压缩只能压缩由直接路径加载插入的数据,只支持有限的数据类型和 SQL 操作。

OLTP table compression

OLTP 表压缩

This type of compression is intended for OLTP applications and compresses data manipulated by any SQL operation.

这种类型的压缩用于 OLTP应用程序,并可压缩任何 SQL 操作的数据。

For basic and OLTP table compression, the database stores compressed rows in row-major format.

数据库以 行主要格式存储压缩行。

All columns of one row are stored together, followed by all columns of the next row, and so on

一个行的所有列都存储在一起,接下来是下一行的所有列,依次类推。

Duplicate values are replaced with a short reference to a symbol table stored at the beginning of the block.

重复值被替换为一个存储在块开始处的符号表短引用。

Thus, information needed to re-create the uncompressed data is stored in the data block itself.

因此,重新创建未压缩数据所需的信息存储在数据块本身中。

Compressed data blocks look much like normal data blocks. Most database features and functions that work on regular data blocks also work on compressed blocks.

压缩的数据块看起来跟正常的数据块差不多。在常规数据块上能正常工作的大多数数据库功能,也可以在压缩的数据块上正常工作。

You can declare compression at the tablespace, table, partition, or subpartition level. If specified at the tablespace level, then all tables created in the tablespace are compressed by default.

您可以在表空间、 表、 分区或子分区等级别声明压缩。如果在表空间级指定了压缩,则在该表空间中创建的所有表在缺省情况下都是压缩的。

The following statement applies OLTP compression to the orders table:

下面的语句将 OLTP 压缩应用于 orders 表:

ALTER TABLE oe.orders COMPRESS FOR OLTP;

The following example of a partial CREATE TABLE statement specifies OLTP compression for one partition and basic compression for the other partition:

如下所示的 CREATE TABLE 语句示例片断,指定其中一个分区为 OLTP 压缩,而其他分区为基本压缩:

CREATE TABLE sales (
    prod_id     NUMBER     NOT NULL,
    cust_id     NUMBER     NOT NULL, ... )
 PCTFREE 5 NOLOGGING NOCOMPRESS
 PARTITION BY RANGE (time_id)
 ( partition sales_2008 VALUES LESS THAN(TO_DATE(...)) COMPRESS BASIC,
   partition sales_2009 VALUES LESS THAN (MAXVALUE) COMPRESS FOR OLTP );

Hybrid Columnar Compression

With Hybrid Columnar Compression, the database stores the same column for a group of rows together. The data block does not store data in row-major format, but uses a combination of both row and columnar methods.

Storing column data together, with the same data type and similar characteristics, dramatically increases the storage savings achieved from compression. The database compresses data manipulated by any SQL operation, although compression levels are higher for direct path loads. Database operations work transparently against compressed objects, so no application changes are required.

Types of Hybrid Columnar Compression

If your underlying storage supports Hybrid Columnar Compression, then you can specify the following compression types, depending on your requirements:

  • Warehouse compression
    This type of compression is optimized to save storage space, and is intended for data warehouse applications.
  • Online archival compression
    This type of compression is optimized for maximum compression levels, and is intended for historical data and data that does not change.

To achieve warehouse or online archival compression, you must use direct path loads, ALTER TABLE . . . MOVE operations, or online table redefinition.

Hybrid Columnar Compression is optimized for Data Warehousing and decision support applications on Exadata storage. Exadata maximizes the performance of queries on tables that are compressed using Hybrid Columnar Compression, taking advantage of the processing power, memory, and Infiniband network bandwidth that are integral to the Exadata storage server.

Other Oracle storage systems support Hybrid Columnar Compression, and deliver the same space savings as on Exadata storage, but do not deliver the same level of query performance. For these storage systems, Hybrid Columnar Compression is ideal for in-database archiving of older data that is infrequently accessed.

Compression Units

Hybrid Columnar Compression uses a logical construct called a compression unit to store a set of rows. When you load data into a table, the database stores groups of rows in columnar format, with the values for each column stored and compressed together. After the database has compressed the column data for a set of rows, the database fits the data into the compression unit.

For example, you apply Hybrid Columnar Compression to a daily_sales table. At the end of every day, you populate the table with items and the number sold, with the item ID and date forming a composite primary key. Table 2-1 shows a subset of the rows in daily_sales.

Table 2-1 Sample Table daily_sales

Item_ID

Date

Num_Sold

Shipped_From

Restock

1000

01-JUN-11

2

WAREHOUSE1

Y

1001

01-JUN-11

0

WAREHOUSE3

N

1002

01-JUN-11

1

WAREHOUSE3

N

1003

01-JUN-11

0

WAREHOUSE2

N

1004

01-JUN-11

2

WAREHOUSE1

N

1005

01-JUN-11

1

WAREHOUSE2

N

Assume that the rows in Table 2-1 are stored in one compression unit. Hybrid Columnar Compression stores the values for each column together, and then uses multiple algorithms to compress each column. The database chooses the algorithms based on a variety of factors, including the data type of the column, the cardinality of the actual values in the column, and the compression level chosen by the user.

As shown in Figure 2-5, each compression unit can span multiple data blocks. The values for a particular column may or may not span multiple blocks.

Figure 2-5 Compression Unit

Description of "Figure 2-5 Compression Unit"

Hybrid Columnar Compression has implications for row locking (see "Row Locks (TX)"). When an update occurs for a row in an uncompressed data block, only the updated row is locked. In contrast, the database must lock all rows in the compression unit if an update is made to any row in the unit. Updates to rows using Hybrid Columnar Compression cause rowids to change.

Note:

When tables use Hybrid Columnar Compression, Oracle DML locks larger blocks of data (compression units), which may reduce concurrency.

Oracle Schema Objects——Tables——Table Compression的更多相关文章

  1. Oracle Schema Objects——Tables——Oracle Data Types

    Oracle Schema Objects Oracle Data Types 数据类型 Data Type Description NUMBER(P,S) Number value having a ...

  2. Oracle Schema Objects——Tables——TableStorage

    Oracle Schema Objects Table Storage Oracle数据库如何保存表数据? Oracle Database uses a data segment in a table ...

  3. Oracle Schema Objects——Tables——TableType

    Oracle Schema Objects Object Tables object type An Oracle object type is a user-defined type with a ...

  4. Oracle Schema Objects——Tables——Overview of Tables

    Oracle Schema Objects Overview of Tables A table is the basic unit of data organization in an Oracle ...

  5. Oracle Schema Objects(Schema Object Storage And Type)

    One characteristic of an RDBMS is the independence of physical data storage from logical data struct ...

  6. Oracle Schema Objects——伪列ROWID Pseudocolumn(ROWNUM、ROWID)

    Oracle Schema Objects Oracle Schema Objects——Tables——Oracle Data Types Oracle伪列 在Oracle数据库之中为了实现完整的关 ...

  7. Oracle Schema Objects——PARTITION

    Oracle Schema Objects 表分区 表- - 分区( partition )TABLE PARTITION 一段时间给出一个分区,这样方便数据的管理. 可以按照范围range分区,列表 ...

  8. Oracle Schema Objects——Index

    索引主要的作用是查询优化. Oracle Schema Objects 查看执行计划的权限:查看执行计划plustrace:set autotrace trace exp stat(SP2-0618. ...

  9. Oracle Schema Objects——Sequences(伪列:nextval,currval)

    Oracle Schema Objects 序列的作用 许多的数据库之中都会为用户提供一种自动增长列的操作,例如:在微软的Access数据库之中就提供了一种自动编号的增长列(ID列).在oracle数 ...

随机推荐

  1. stm32中的数据类型定义

    STM32F10X.H #include "core_cm3.h" #include "system_stm32f10x.h" #include <std ...

  2. Linux下双网卡-双外网网关-电信联通双线主机设置

    1.实现:通过运营商提供的智能DNS,把电信用户访问时,数据进电信的网卡,出来时也从电信的网关出来,访问联通时,从联通网卡时,联通网卡出.这样速度就会快,实现双线主机的功能. 2.网卡信息:电信IP( ...

  3. unity, rigidbody实现瞬移必须勾选is Kinematic

    用itween让一个绑定了rigidbody的沿曲线移动,当移动到末端时瞬间返回起始状态重新播放. 发现在不勾选isKinematic的情况下是不可能实现上述需求的.因为在动力学模式下任何物体的位置和 ...

  4. jcifs 具体解释读取网络共享文件数据

    时隔1年半,没有发过新的帖子了,也没怎么来过CSDN逛逛了,人也懒散了. 今天收到网友的提问,才回来看看.认为应该再写点什么出来.只是.发现自己研究是不是太深入,写不出那么高深的东西.那就写点肤浅的东 ...

  5. The server has either erred or is incapable of performing the requested operation. (HTTP 500)

    感谢朋友支持本博客,欢迎共同探讨交流,因为能力和时间有限,错误之处在所难免,欢迎指正. 假设转载.请保留作者信息. 博客地址:http://blog.csdn.net/qq_21398167 原博文地 ...

  6. jQuery插件学习笔记

    近期在研究jQuery插件,插件编写的目的是给已经有的一系列方法或函数做一个封装,以便在其它地方反复使用,方便后期维护. JQuery除了提供一个简单.有效的方式进行管理元素以及脚本,它还还提供了例外 ...

  7. java为啥计算时间从1970年1月1日开始

    http://www.myexception.cn/program/1494616.html ————————————————————————————————————————————————————— ...

  8. 宝宝书 & 网站

    1. 网站 妈妈帮 宝宝树 2. 图书推荐 育儿百科 育儿经 中国儿童智力方程 聪明宝宝营养食谱1001例

  9. ACM/ICPC Moscow Prefinal 2019 趣题记录

    ### Day1: ### **Problem C:** 设$k_i​$为$[A, B]​$中二进制第$i​$位是1的数的个数. 给出$k_0 \cdots k_{63}​$, 求出$[A, B]​$ ...

  10. C++设计模式之建造者模式(二)

    3.省略指挥者Director的建造者模式 指挥者类Director在建造者模式中扮演很关键的数据.简单的Director类用于指导详细建造者怎样构建产品,它按一定次序调用Builder的buildP ...