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

时间:2024-10-11 10:34:12

ReplacingMergeTree

为了解决MergeTree表引擎相同主键无法去重的问题,云数据库ClickHouse提供了ReplacingMergeTree表引擎,用于删除主键值相同的重复项。

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