数据部分何时合并

When Data part will be merge

我正在使用 CollapsingMergeTree 引擎按照文档更新数据 (https://clickhouse.yandex/docs/en/operations/table_engines/collapsingmergetree/#collapsing)

基于文档:

CollapsingMergeTree asynchronously deletes (collapses) pairs of rows if all of the fields in a row are equivalent excepting the particular field Sign which can have 1 and -1 values

As we need only the last state of user activity, the rows [....] can be deleted collapsing the invalid (old) state of an object. CollapsingMergeTree does this while merging of the data parts.

我能知道什么时候合并数据部分吗?是否有命令强制 Clickhouse 合并数据部分?

谢谢。

Can I know when Data parts will be merge ?

ClickHouse 以不确定的方式安排异步作业。参见 https://github.com/yandex/ClickHouse/blob/master/dbms/src/Storages/MergeTree/BackgroundProcessingPool.cpp#L29

这些工作包括 data parts clean updata parts mergedata parts mutation

And is there command to force Clickhouse to merge data part ?

是的,https://clickhouse.yandex/docs/en/query_language/misc/#optimize