【发布时间】:2020-12-01 10:58:32
【问题描述】:
根据documentation,ReplacingMergeTree 引擎不保证不存在重复项。这是否意味着我不能指望这个引擎,我必须使用自己的方法来控制重复项?
【问题讨论】:
标签: clickhouse
根据documentation,ReplacingMergeTree 引擎不保证不存在重复项。这是否意味着我不能指望这个引擎,我必须使用自己的方法来控制重复项?
【问题讨论】:
标签: clickhouse
是的,这确实意味着你不能指望这个引擎。
对于小的 ReplacingMergeTree 表可以使用 FINAL 关键字。
select ... from SomeReplacingMergeTreeTable FINAL
https://clickhouse.tech/docs/en/sql-reference/statements/select/from/#select-from-final
或argMax group by 或order by ... limit by ...
但最好的解决方案是重新设计数据流并避免重复。
【讨论】: