estimateCompressionRatio
導入バージョン: v25.4.0
指定されたカラムを圧縮せずに、その圧縮率を推定します。
構文
estimateCompressionRatio([codec, block_size_bytes])(column)パラメータ
codec— 圧縮コーデック、またはカンマ区切りの複数のコーデックを 1 つの文字列で指定したString。Stringblock_size_bytes— 圧縮データのブロックサイズです。これはmax_compress_block_sizeとmin_compress_block_sizeの両方を設定するのと同様です。デフォルト値は 1 MiB (1048576 バイト) です。指定可能な最大値は 256 MiB (268435456 バイト) です。UInt64
引数
column— 任意の型のカラム。Any
戻り値
指定したカラムの推定圧縮率を返します。Float64
例
デフォルトのコーデックを使用する基本的な使い方
CREATE TABLE compression_estimate_example
(
`number` UInt64
)
ENGINE = MergeTree()
ORDER BY number
SETTINGS min_bytes_for_wide_part = 0;
INSERT INTO compression_estimate_example
SELECT number FROM system.numbers LIMIT 100_000;
SELECT estimateCompressionRatio(number) AS estimate FROM compression_estimate_example┌───────────estimate─┐
│ 1.9988506608699999 │
└────────────────────┘特定のコーデックを使用する
SELECT estimateCompressionRatio('T64')(number) AS estimate FROM compression_estimate_example┌──────────estimate─┐
│ 3.762758101688538 │
└───────────────────┘複数のコーデックを使用する
SELECT estimateCompressionRatio('T64, ZSTD')(number) AS estimate FROM compression_estimate_example┌───────────estimate─┐
│ 143.60078980434392 │
└────────────────────┘