Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

add CH performance projections

Francis Cao9f86462a5432
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
+ )
+);