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

Мутации обновления

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

к сведению

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

ALTER TABLE ... UPDATE Statements

Manipulates 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.

The filter_expr must be of type UInt8. This query updates values of specified columns to the values of corresponding expressions in rows for which the filter_expr takes a non-zero value. Values are cast to the column type using the CAST operator. Updating columns that are used in the calculation of the primary or the partition key is not supported.

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