From 9f86462a543252d8be98e5ac66d7b21f612427fa Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Mon, 3 Aug 2026 16:51:14 -0700 Subject: [PATCH] add CH performance projections --- .../14_add_performance_projections.sql | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 db/clickhouse/migrations/14_add_performance_projections.sql diff --git a/db/clickhouse/migrations/14_add_performance_projections.sql b/db/clickhouse/migrations/14_add_performance_projections.sql new file mode 100644 index 000000000..d1ec05d68 --- /dev/null +++ b/db/clickhouse/migrations/14_add_performance_projections.sql @@ -0,0 +1,28 @@ +-- Add projections for website activity feeds and event property filters. +-- Note: these are intentionally not materialized here to avoid a large +-- backfill during migration on production-sized datasets. + +ALTER TABLE umami.website_event +ADD PROJECTION website_event_activity_projection ( + SELECT * + ORDER BY ( + website_id, + created_at, + event_id + ) +); + +ALTER TABLE umami.event_data +ADD PROJECTION event_data_property_filter_projection ( + SELECT * + ORDER BY ( + website_id, + data_key, + data_type, + string_value, + number_value, + date_value, + created_at, + event_id + ) +);