Nonstop Database, HiRDB Version 9 Description
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
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.
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
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:
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.