南大通用GBase 8a在V95支持压缩算法和压缩等级的功能说明和使用样例

GBase 8a从V95开始,支持多种压缩算法和压缩等级,本文介绍该功能的使用方法和样例。

压缩算法 gbase_compress_method

只读参数,只能通过配置文件,设置全局的压缩算法。

  • NoZip 无压缩
  • HighZ 高压缩比
  • RapidZ 快速压缩
  • STDZ 标准压缩

压缩等级 gbase_compress_level

取值0-9;

  • 0=默认级别
  • 1=压缩比最低,压缩和解压缩速度最快
  • 9=压缩比最高,压缩和解压缩速度最慢

兼容说明

  • Compress(’NoZip‘,0)=compress(0,0)
  • Compress(’HighZ’,0‘)=compress(1,3)
  • Compress(’RapidZ‘,0‘)=compress(5,5)
  • Compress(’STDZ’,0‘)=compress(’STDZ‘,3)

样例

表级

gbase> create table t6(id int) compress('STDZ',9);
Query OK, 0 rows affected (Elapsed: 00:00:00.13)

gbase> show create table t6;
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                           |
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
| t6    | CREATE TABLE "t6" (
  "id" int(11) DEFAULT NULL
) COMPRESS('STDZ', 9)  ENGINE=EXPRESS DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (Elapsed: 00:00:00.00)

列级

gbase> create table t5(id int compress('STDZ',9));
Query OK, 0 rows affected (Elapsed: 00:00:00.11)

gbase> show create table t5;
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                           |
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
| t5    | CREATE TABLE "t5" (
  "id" int(11) DEFAULT NULL COMPRESS('STDZ', 9)
) ENGINE=EXPRESS DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (Elapsed: 00:00:00.00)