CaptainVoronin
CaptainVoronin

Reputation: 93

Clickhouse. ReplacingMergeTree doesn't guarantee absence of duplicates

According to the documentation the ReplacingMergeTree engine does not guarantee absence of duplicates. Does it mean I must not count on this engine and I have to use my own method for control duplicates?

Upvotes: 1

Views: 1640

Answers (1)

Denny Crane
Denny Crane

Reputation: 13310

Yes, it does mean that you must not count on this engine.

For a small ReplacingMergeTree tables you can FINAL keyword.

select ... from SomeReplacingMergeTreeTable FINAL

https://clickhouse.tech/docs/en/sql-reference/statements/select/from/#select-from-final

Or argMax group by or order by ... limit by ...

But the best solution is to redesign dataflow and avoid duplicates.

Upvotes: 3

Related Questions