Перейти к основному содержимому
Перейти к основному содержимому

Мутации удаления

Мутации удаления относятся к запросам ALTER, которые манипулируют данными таблицы путем удаления. В частности, это такие запросы, как ALTER TABLE DELETE и т.д. Выполнение таких запросов приведет к созданию новых мутированных версий частей данных. Это означает, что такие операторы вызовут перезапись целых частей данных для всех данных, которые были вставлены до мутации, что приведет к большому количеству запросов на запись.

к сведению

Для удаления вы можете избежать больших объемов запросов на запись, используя специализированные движки таблиц, такие как ReplacingMergeTree или CollapsingMergeTree, вместо стандартного движка таблиц MergeTree.

ALTER TABLE ... DELETE Statement

Deletes data matching the specified filtering expression. Implemented as a mutation.

примечание

The ALTER TABLE prefix makes this syntax different from most other systems supporting SQL. It is intended to signify that unlike similar queries in OLTP databases this is a heavy operation not designed for frequent use. ALTER TABLE is considered a heavyweight operation that requires the underlying data to be merged before it is deleted. For MergeTree tables, consider using the DELETE FROM query, which performs a lightweight delete and can be considerably faster.

The filter_expr must be of type UInt8. The query deletes rows in the table for which this expression takes a non-zero value.

One query can contain several commands separated by commas.

The synchronicity of the query processing is defined by the mutations_sync setting. By default, it is asynchronous.

See also