Nonstop Database, HiRDB Version 9 Description

[Contents][Glossary][Index][Back][Next]

3.3.16 Compressed tables

You can compress data that HiRDB stores in a table. This is called the data compression facility. You can specify data compression for each column individually. A column for which compression is specified is called a compressed column, and a table containing a compressed column is specified is called a compressed table. For details about compressed tables, see the HiRDB Version 9 Installation and Design Guide.

Data compression by HiRDB provides the following benefits:

The following figure provides an overview of data compression.

Figure 3-21 Overview of data compression

[Figure]

Explanation
Because HiRDB executes data compression and expansion, the user need not specify these operations.
Organization of this subsection
(1) Application criteria
(2) Data compression mechanism
(3) Defining a compressed table
(4) Notes on using compressed tables

(1) Application criteria

We recommend specifying tables that contain large-size, variable-length binary data, such as image and audio data, as compressed tables. Note, however, that compressing tables results in compression and expansion processing overhead. Therefore, use data compression in systems in which storage efficiency is more important than performance.

(2) Data compression mechanism

The compression library you use for data compression is zlib. Using zlib, HiRDB compresses data into the split compression size (default: MIN (32,000 bytes, compressed column definition length)) that was specified during table definition. During this process, HiRDB adds a header area (8 bytes) to manage the data pre- and post-compression, when it is compressed to each split compression size (this is separate from the header area added by zlib to the compressed data).

If the data size does not change from before compression to after, or if the data size is longer after compression, HiRDB stores the data without compressing it. Consequently, the addition of a header area makes the post-compression data larger than the pre-compression data in some cases. The following figure shows an example of pre- and post-compression data.

Figure 3-22 Pre- and post-compression data

[Figure]

(3) Defining a compressed table

Specify compression (COMPRESSED) in the column definition of the CREATE TABLE definition SQL. As needed, also specify the split compression size. Note that the following restrictions apply to compression specification:

#
To compress data of a column with the abstract data type (XML type), you must have HiRDB XML Extension, Version 09-03 or newer.

(4) Notes on using compressed tables