OceanBase Database supports two data compression methods: data encoding and data compression by using general-purpose compression algorithms such as lz4_1.0 and zstd_1.0.
When you create a table or modify table attributes in OceanBase Database, you can set COMPRESS to specify whether to enable data encoding and specify the compression algorithm to be used. Sample SQL statements:
Disable data encoding and general-purpose compression algorithms.
CREATE TABLE table_name NOCOMPRESS; ALTER TABLE table_name [MOVE] NOCOMPRESS;
Disable data encoding and use the lz4_1.0 compression algorithm.
CREATE TABLE table_name COMPRESS [BASIC]; ALTER TABLE table_name [MOVE] COMPRESS [BASIC];
Disable data encoding and use the lz4_1.0 compression algorithm.
CREATE TABLE table_name COMPRESS FOR OLTP; ALTER TABLE table_name [MOVE] COMPRESS FOR OLTP;
Enable data encoding and use the zstd_1.0 compression algorithm.
CREATE TABLE table_name COMPRESS FOR QUERY [LOW|HIGH]; ALTER TABLE table_name [MOVE] COMPRESS FOR QUERY [LOW|HIGH];
Enable data encoding and use the zstd_1.0 compression algorithm.
CREATE TABLE table_name COMPRESS FOR ARCHIVE [LOW|HIGH]; ALTER TABLE table_name [MOVE] COMPRESS FOR ARCHIVE [LOW|HIGH];
For more information, see Compression and encoding.