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

> ALTER TABLE ... DELETE ステートメントに関するドキュメント

# ALTER TABLE ... DELETE ステートメント

```sql theme={null}
ALTER TABLE [db.]table [ON CLUSTER cluster] DELETE WHERE filter_expr
```

指定されたフィルタ式に一致するデータを削除します。[ミューテーション](/ja/reference/statements/alter/index#mutations)として実装されています。

<Warning>
  `ALTER TABLE` という接頭辞は、OLTP データベースの類似したクエリとは異なり、これが重量級の操作であることを示します。`ALTER TABLE ... DELETE` は、フィルタ式に一致する行を含むすべてのデータパートを書き換えるため、大量の書き込み I/O が発生します。`SELECT` のパフォーマンスに影響する可能性があるため、使用は控えめにしてください。

  `MergeTree` テーブルでは、論理削除を実行でき、はるかに高速になる場合がある [`DELETE FROM` クエリ](/ja/reference/statements/delete) の使用を検討してください。頻繁な削除や修正が必要なワークロードでは、[`ReplacingMergeTree`](/ja/concepts/features/operations/update/replacing-merge-tree) または [`CollapsingMergeTree`](/ja/reference/engines/table-engines/mergetree-family/collapsingmergetree) の使用を検討してください。
</Warning>

`filter_expr` は `UInt8` 型である必要があります。この式が 0 以外の値を取るテーブル内の行が削除されます。

1 つのクエリには、カンマで区切られた複数のコマンドを含めることができます。

クエリ処理の同期性は、[mutations\_sync](/ja/reference/settings/session-settings/mutations#mutations_sync) 設定で定義されます。デフォルトでは非同期です。

**関連項目**

* [ミューテーション](/ja/reference/statements/alter/index#mutations)
* [ALTER クエリの同期性](/ja/reference/statements/alter/index#synchronicity-of-alter-queries)
* [mutations\_sync](/ja/reference/settings/session-settings/mutations#mutations_sync) 設定

<div id="related-content">
  ## 関連コンテンツ
</div>

* ブログ: [ClickHouse での更新と削除の処理](https://clickhouse.com/blog/handling-updates-and-deletes-in-clickhouse)
