表格存储服务 CLOUDTABLE-ClickHouse表引擎概述:CollapsingMergeTree

时间:2025-01-10 15:12:56

CollapsingMergeTree

CollapsingMergeTree表引擎用于消除ReplacingMergeTree表引擎的功能限制。该表引擎要求在建表语句中指定一个标记列Sign,按照Sign的值将行分为两类:Sign=1的行称为状态行,用于新增状态。Sign=-1的行称为取消行,用于删除状态。

  • 建表语句。
    CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER ClickHouse集群名]
    (
        name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1],
        name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2],
        ...
    ) ENGINE = CollapsingMergeTree(sign)
    [PARTITION BY expr]
    [ORDER BY expr]
    [SAMPLE BY expr]
    [SETTINGS name=value, ...]
support.huaweicloud.com/devg-cloudtable/cloudtable_01_0312.html