OceanBase Database supports two methods for table compression. One method is to compress tables by using data encoding, and the other is to compress tables by using general algorithms such as lz4_1.0 and zstd_1.3.8.
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 are as follows:
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
zstd_1.3.8compression algorithm.CREATE TABLE table_name COMPRESS FOR OLTP; ALTER TABLE table_name [MOVE] COMPRESS FOR OLTP;Enable data encoding and use the
lz4_1.0compression 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.3.8compression 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.