fix: set deduplicate_merge_projection_mode for ReplacingMergeTree projection
ClickHouse 24.12 requires this setting before adding projections to ReplacingMergeTree tables. Using 'drop' mode which discards the projection during deduplication merges and rebuilds it afterward. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
-- Projection for fast route_id + instance_id lookups on route_diagrams.
|
-- Projection for fast route_id + instance_id lookups on route_diagrams.
|
||||||
-- The primary key is (tenant_id, content_hash) which serves hash-based lookups.
|
-- The primary key is (tenant_id, content_hash) which serves hash-based lookups.
|
||||||
-- Queries filtering by route_id + instance_id were scanning millions of rows.
|
-- Queries filtering by route_id + instance_id were scanning millions of rows.
|
||||||
|
-- ReplacingMergeTree requires deduplicate_merge_projection_mode to be set (ClickHouse 24.12+).
|
||||||
|
ALTER TABLE route_diagrams MODIFY SETTING deduplicate_merge_projection_mode = 'drop';
|
||||||
|
|
||||||
ALTER TABLE route_diagrams
|
ALTER TABLE route_diagrams
|
||||||
ADD PROJECTION IF NOT EXISTS prj_route_instance
|
ADD PROJECTION IF NOT EXISTS prj_route_instance
|
||||||
(SELECT content_hash, created_at ORDER BY tenant_id, route_id, instance_id, created_at);
|
(SELECT content_hash, created_at ORDER BY tenant_id, route_id, instance_id, created_at);
|
||||||
|
|||||||
Reference in New Issue
Block a user