引擎
| 引擎 | 能力 | 注意 |
|---|---|---|
| MergeTree | 通用追加 | 不去重 |
| ReplacingMergeTree | 同键去重 | 去重时机不确定 |
| SummingMergeTree | 数值预聚合 | 只按排序键合并 |
| CollapsingMergeTree | 状态折叠 | 需成对写入 |
Replacing 引擎
Replacing 引擎
CREATE TABLE dw.dim_store
(
store_id String,
store_name String,
version UInt64
)
ENGINE = ReplacingMergeTree(version)
ORDER BY store_id;ReplacingMergeTree 的合并是后台异步的,查询要精确去重需要 FINAL 或自行按版本过滤。