> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 指定したカラムを実際に圧縮せずに、その圧縮率を推定します。

# estimateCompressionRatio

<div id="estimateCompressionRatio">
  ## estimateCompressionRatio
</div>

導入バージョン: v25.4.0

指定されたカラムを圧縮せずに、その圧縮率を推定します。

<Note>
  以下の例では、結果はサーバーのデフォルトの圧縮コーデックによって異なります。
  [カラム圧縮コーデック](/ja/reference/statements/create/table#column_compression_codec)を参照してください。
</Note>

**構文**

```sql theme={null}
estimateCompressionRatio([codec, block_size_bytes])(column)
```

**パラメータ**

* `codec` — 圧縮コーデック、またはカンマ区切りの複数のコーデックを 1 つの文字列で指定した `String`。[`String`](/ja/reference/data-types/string)
* `block_size_bytes` — 圧縮データのブロックサイズです。これは [`max_compress_block_size`](/ja/reference/settings/merge-tree-settings#max_compress_block_size) と [`min_compress_block_size`](/ja/reference/settings/merge-tree-settings#min_compress_block_size) の両方を設定するのと同様です。デフォルト値は 1 MiB (1048576 バイト) です。指定可能な最大値は 256 MiB (268435456 バイト) です。[`UInt64`](/ja/reference/data-types/int-uint)

**引数**

* `column` — 任意の型のカラム。[`Any`](/ja/reference/data-types)

**戻り値**

指定したカラムの推定圧縮率を返します。[`Float64`](/ja/reference/data-types/float)

**例**

**デフォルトのコーデックを使用する基本的な使い方**

```sql title=Query theme={null}
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
```

```response title=Response theme={null}
┌───────────estimate─┐
│ 1.9988506608699999 │
└────────────────────┘
```

**特定のコーデックを使用する**

```sql title=Query theme={null}
SELECT estimateCompressionRatio('T64')(number) AS estimate FROM compression_estimate_example
```

```response title=Response theme={null}
┌──────────estimate─┐
│ 3.762758101688538 │
└───────────────────┘
```

**複数のコーデックを使用する**

```sql title=Query theme={null}
SELECT estimateCompressionRatio('T64, ZSTD')(number) AS estimate FROM compression_estimate_example
```

```response title=Response theme={null}
┌───────────estimate─┐
│ 143.60078980434392 │
└────────────────────┘
```
