GBase 8s Data Compression Strategy Explained (Part 2)
This article (Chapter 2) provides a detailed overview of GBase 8s data compression features, including their purpose, methods, commands, and limitations. GBase 8s data compression is used when storage space is limited and you need to reduce data footprint and improve data processing efficiency. It is also recommended to compress inactive tables and fragments. It offers an effective solution for saving storage space and improving I/O efficiency.
04 Checking Data Compression Commands
1. onstat -g ppd: After performing data compression, you can view the data dictionary
Example: execute function task('table create_dictionary', ‘table', ‘db',‘gbasedbt');
onstat -g ppdpartnum ColOffset DbsNum CrTS CrLogID CrLogPos DrTS DrLogID DrLogPos0x1001d5 -1 1 1393371661 4 16339024 0 0 00x1001d5 4 1 1393371661 4 16355408 0 0 0
partnum: Partition number that the compression dictionary applies to
ColOffset: Byte offset of the BLOB column for a compressed partition; -1 indicates only rows are compressed
DbsNum: Number of dbspaces residing in the dictionary
CrTS: Timestamp when the data dictionary was created
CrLogID: Unique ID of the logical log generated when the data dictionary was created
CrLogPos: Position in the logical log when the data dictionary was created
DrTS: Timestamp when the data dictionary was cleared
DrLogID: Unique ID of the logical log generated when the data dictionary was cleared
DrLogPos: Position in the logical log when the data dictionary was cleared
2. Estimate Compression Ratio
execute function task("table estimate_compression", "tablename", "dbname", "owner_name"); est curr change partnum coloff table----- ----- ------ ------------- -----------------------------75.7% 75.3% +0.4 0x00200003 -1 insurance:bwilson.auto75.7% 0.0% +75.7 0x00300002 -1 insurance:pchang.home
est: Existing compression ratio
curr: Current compression ratio
change: Compression ratio change from existing to current
partnum: Fragment number
coloff: Evaluates whether the data in the dbspace is row data or BLOB data
table: Table name, database:owner.tablename
3. Print Currently Running Compression Operation Commands
onstat –g dsk Processed Remaining Duration Partnum OP Pass Rows Blobs Rows Time(s) Table Name400002 Repack 1 6325 1752 1497 00:00:00 db:sl:t1
partnum: Fragment number
OP: Compression operation, e.g., compress, repack, or shrink
Pass: For repack operations, 1 means row read pass, 2 means second pass
Processed Rows: Number of rows processed
Blobs: Number of BLOBs processed
Remaining Rows: Number of uncompressed rows
Duration Time(s): Duration of the operation in seconds
Table Name: Table name
05 Data Compression Limitations
The following cannot be compressed:
1. Data not stored by rows (BLOBs)
2. Indexes
3. Temporary tables
4. Catalog tables
5. Tables in system databases
GBase 8s data compression technology is an essential tool for DBAs and developers to optimize storage and improve performance. Through this detailed introduction, we hope to help you more effectively leverage GBase 8s compression features. Thank you for reading.