This syntax is problematic; I tested it and it directly reported an error. I couldn’t find the specific usage of COLUMN_FORMAT in the TiDB documentation, nor did I see the COMPRESSED parameter.
I checked the official MySQL documentation, and in MySQL, COLUMN_FORMAT corresponds to the parameters FIXED, DYNAMIC, and DEFAULT. There is no COMPRESSED parameter.
In NDB Cluster, it is also possible to specify a data storage format for individual columns of NDB tables using COLUMN_FORMAT. Permissible column formats are FIXED, DYNAMIC, and DEFAULT. FIXED is used to specify fixed-width storage, DYNAMIC permits the column to be variable-width, and DEFAULT causes the column to use fixed-width or variable-width storage as determined by the column’s data type (possibly overridden by a ROW_FORMAT specifier).
This seems to be an AI-generated answer, but it is incorrect.
TiDB compression is implemented through TiKV’s RocksDB, and it is automatically enabled by default. You can specify the compression algorithm in TiKV.
Reference:
TiKV Memory Parameter Performance Tuning | PingCAP Documentation Center
[rocksdb.defaultcf]
Data block size. RocksDB compresses data in blocks, and blocks are also the smallest unit cached in the block-cache (similar to the page concept in other databases).
block-size = “64KB”
The compression method for each level of RocksDB data can be: no, snappy, zlib, bzip2, lz4, lz4hc, zstd. Note that Snappy compressed files must follow the official Snappy format. Other non-official compression formats are not supported.
no:no:lz4:lz4:lz4:zstd:zstd means no compression for level0 and level1, lz4 compression for level2 to level4, and zstd compression for level5 and level6.
no means no compression, lz4 is a balanced compression algorithm in terms of speed and compression ratio, zlib has a high compression ratio and is storage-friendly but slow in compression speed and requires more CPU resources. Different machines need to configure the compression method based on CPU and I/O resources. For example, if the compression method is “no:no:lz4:lz4:lz4:zstd:zstd”, and during heavy data writes (data import), you find that the system’s I/O pressure is high (using iostat to find %util continuously at 100% or using top command to find high iowait), but CPU resources are still sufficient, you can consider enabling compression for level0 and level1 to trade CPU resources for I/O resources. If the compression method is “no:no:lz4:lz4:lz4:zstd:zstd”, and during heavy data writes, you find that the system’s I/O pressure is low but CPU resources are exhausted, and top -H shows many bg-prefixed threads (RocksDB compaction threads) running, you can consider trading I/O resources for CPU resources by changing the compression method to “no:no:no:lz4:lz4:zstd:zstd”. The goal is to maximize the utilization of existing system resources to fully leverage TiKV’s performance under current resource conditions.
compression-per-level = [“no”, “no”, “lz4”, “lz4”, “lz4”, “zstd”, “zstd”]