Skip to content
Theory · ClickHouse: Aggregates, Materialized Views, MergeTree Engines · lesson 3 of 12

ReplacingMergeTree: the latest row version

At the end of the previous chapter we agreed: an order's status is not changed by a mutation but inserted as a new row. That is how the sample database's status_log table works: order 1 first has a row new with version 1, then paid with version 2, then served with version 3. An order report needs only the last row of each order.

In this lesson

  • The ReplacingMergeTree engine
  • FINAL and argMax
  • Uniqueness is not guaranteed
  • Common mistake
  • Key points