Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Available from version 25.6This table engine is available from version 25.6 and higher in both OSS and Cloud.
CoalescingMergeTree tables, ClickHouse replaces all rows with the same primary key (or more precisely, the same sorting key) with a single row that contains the latest non-NULL values for each column.
This enables column-level upserts, meaning you can update only specific columns rather than entire rows.
CoalescingMergeTree is intended for use with Nullable types in non-key columns. If the columns are not Nullable, the behavior is the same as with ReplacingMergeTree.
Creating a table
Parameters of CoalescingMergeTree
Columns
columns - Optional. A tuple with the names of columns where values will be united. The provided columns must not be in the partition or sorting key. If columns is not specified, ClickHouse unites the values in all columns that are not in the sorting key.
Query clauses
When creating aCoalescingMergeTree table the same clauses are required, as when creating a MergeTree table.
Usage example
Consider the following table:FINAL modifier forces ClickHouse to apply merge logic at query time, ensuring you get the correct, coalesced “latest” value for each column. This is the safest and most accurate method when querying from a CoalescingMergeTree table.
An approach with
GROUP BY may return incorrect results if the underlying parts have not been fully merged.