Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(clickhouse): drop person_property_mutation_log pipeline (#108780)

Bryan Ciaraldidfa2ec5a2560
diff --git a/docs/internal/clickhouse-deletion-coverage.md b/docs/internal/clickhouse-deletion-coverage.md
index db3449411434..44efa60ebfdf 100644
--- a/docs/internal/clickhouse-deletion-coverage.md
+++ b/docs/internal/clickhouse-deletion-coverage.md
@@ -109,8 +109,6 @@ Each is a decision that erasure may lag by the retention window.
- `sharded_events_recent` — a transient mirror of the last few days of events, 7-day TTL keyed on `inserted_at`. It partitions by day with `ttl_only_drop_parts = 1`, so a part drops only once its newest row expires: the real worst case is about 8 days plus TTL-merge lag, not a flat 7. Short enough to accept as the erasure bound, and a sweep would race the TTL for little benefit.
-- `person_property_mutation_log_data` retains submitted person updates for 30 days from the Kafka message timestamp. It stores only `team_id`, `event_uuid`, `properties`, and `ingested_at`, so person-based sweeps cannot target it directly. Daily partitions drop after their newest row expires, plus TTL-merge lag.
-
Session recordings, the dead letter queue, and logs are likewise TTL-reclaimed.
That decision predates this document; the older `posthog/models/async_deletion/delete_events.py` records it in a comment, but that module is legacy and is not the source of truth here.
diff --git a/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl b/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl
index 28130424b23d..d5c6e23ce68d 100644
--- a/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl
@@ -1082,53 +1082,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
- table "person_property_mutation_log_data" {
- order_by = ["team_id", "event_uuid"]
- partition_by = "toDate(ingested_at)"
- ttl = "ingested_at + toIntervalDay(30)"
- settings = {
- index_granularity = "1024"
- ttl_only_drop_parts = "1"
- }
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "replicated_replacing_merge_tree" {
- zoo_path = "/clickhouse/tables/noshard/posthog.person_property_mutation_log_data"
- replica_name = "{replica}-{shard}"
- version_column = "ingested_at"
- }
- }
-
table "property_values" {
order_by = ["team_id", "property_type", "property_key", "property_value"]
ttl = "last_seen + toIntervalDay(30)"
diff --git a/posthog/clickhouse/hcl/golden/dev/data.hcl b/posthog/clickhouse/hcl/golden/dev/data.hcl
index 481de3fb75dd..daff69ead61b 100644
--- a/posthog/clickhouse/hcl/golden/dev/data.hcl
+++ b/posthog/clickhouse/hcl/golden/dev/data.hcl
@@ -2859,26 +2859,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
table "person_static_cohort" {
order_by = ["team_id", "cohort_id", "person_id", "id"]
settings = {
diff --git a/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl b/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl
index 23f3a4df7d4c..2258bab23f1f 100644
--- a/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl
@@ -1125,53 +1125,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
- table "person_property_mutation_log_data" {
- order_by = ["team_id", "event_uuid"]
- partition_by = "toDate(ingested_at)"
- ttl = "ingested_at + toIntervalDay(30)"
- settings = {
- index_granularity = "1024"
- ttl_only_drop_parts = "1"
- }
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "replicated_replacing_merge_tree" {
- zoo_path = "/clickhouse/tables/noshard/posthog.person_property_mutation_log_data"
- replica_name = "{replica}-{shard}"
- version_column = "ingested_at"
- }
- }
-
table "property_values" {
order_by = ["team_id", "property_type", "property_key", "property_value"]
ttl = "last_seen + toIntervalDay(30)"
diff --git a/posthog/clickhouse/hcl/golden/local-multi/data.hcl b/posthog/clickhouse/hcl/golden/local-multi/data.hcl
index b48ba0a2d568..46d8d2f38854 100644
--- a/posthog/clickhouse/hcl/golden/local-multi/data.hcl
+++ b/posthog/clickhouse/hcl/golden/local-multi/data.hcl
@@ -3311,26 +3311,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
table "person_static_cohort" {
order_by = ["team_id", "cohort_id", "person_id", "id"]
settings = {
diff --git a/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hcl b/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hcl
index ca5bd90fa317..546411e74efb 100644
--- a/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hcl
+++ b/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hcl
@@ -195,45 +195,6 @@ database "posthog" {
}
}
- table "kafka_person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- engine "kafka" {
- collection = "warpstream_ingestion"
- topic_list = "clickhouse_events_json"
- group_name = "clickhouse_person_property_mutation_log"
- format = "JSONEachRow"
- skip_broken_messages = 100
- }
- }
-
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
table "query_log_archive" {
column "hostname" {
type = "LowCardinality(String)"
@@ -1090,50 +1051,6 @@ SQL
type = "UInt8"
}
}
-
- materialized_view "person_property_mutation_log_mv" {
- to_table = "posthog.person_property_mutation_log"
- query = <<SQL
-SELECT
- team_id,
- uuid AS event_uuid,
- concat(
- '{',
- arrayStringConcat(
- arrayMap(
- property -> concat(toJSONString(property.1), ':', property.2),
- arrayFilter(
- property -> property.1 IN ('$set', '$set_once', '$unset'),
- JSONExtractKeysAndValuesRaw(source.properties)
- )
- ),
- ','
- ),
- '}'
- ) AS properties,
- toDateTime(_timestamp, 'UTC') AS ingested_at
-FROM kafka_person_property_mutation_log AS source
-WHERE
- JSONHas(source.properties, '$set')
-OR
- JSONHas(source.properties, '$set_once')
-OR
- JSONHas(source.properties, '$unset')
-SQL
-
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- }
}
named_collection "msk_cluster" {
diff --git a/posthog/clickhouse/hcl/golden/local-single/all.hcl b/posthog/clickhouse/hcl/golden/local-single/all.hcl
index 63591521903d..69f1ddf7d752 100644
--- a/posthog/clickhouse/hcl/golden/local-single/all.hcl
+++ b/posthog/clickhouse/hcl/golden/local-single/all.hcl
@@ -4139,25 +4139,6 @@ database "posthog" {
}
}
- table "kafka_person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- engine "kafka" {
- collection = "warpstream_ingestion"
- topic_list = "clickhouse_events_json"
- group_name = "clickhouse_person_property_mutation_log"
- format = "JSONEachRow"
- skip_broken_messages = 100
- }
- }
-
table "kafka_plugin_log_entries" {
column "id" {
type = "UUID"
@@ -8564,53 +8545,6 @@ SQL
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
- table "person_property_mutation_log_data" {
- order_by = ["team_id", "event_uuid"]
- partition_by = "toDate(ingested_at)"
- ttl = "ingested_at + toIntervalDay(30)"
- settings = {
- index_granularity = "1024"
- ttl_only_drop_parts = "1"
- }
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "replicated_replacing_merge_tree" {
- zoo_path = "/clickhouse/tables/noshard/posthog.person_property_mutation_log_data"
- replica_name = "{replica}-{shard}"
- version_column = "ingested_at"
- }
- }
-
table "person_static_cohort" {
order_by = ["team_id", "cohort_id", "person_id", "id"]
settings = {
@@ -23600,50 +23534,6 @@ SQL
}
}
- materialized_view "person_property_mutation_log_mv" {
- to_table = "posthog.person_property_mutation_log"
- query = <<SQL
-SELECT
- team_id,
- uuid AS event_uuid,
- concat(
- '{',
- arrayStringConcat(
- arrayMap(
- property -> concat(toJSONString(property.1), ':', property.2),
- arrayFilter(
- property -> property.1 IN ('$set', '$set_once', '$unset'),
- JSONExtractKeysAndValuesRaw(source.properties)
- )
- ),
- ','
- ),
- '}'
- ) AS properties,
- toDateTime(_timestamp, 'UTC') AS ingested_at
-FROM kafka_person_property_mutation_log AS source
-WHERE
- JSONHas(source.properties, '$set')
-OR
- JSONHas(source.properties, '$set_once')
-OR
- JSONHas(source.properties, '$unset')
-SQL
-
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- }
-
materialized_view "plugin_log_entries_mv" {
to_table = "posthog.writable_plugin_log_entries"
query = <<SQL
diff --git a/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl b/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl
index 94209fb06645..593db5dfcb4f 100644
--- a/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl
@@ -1082,53 +1082,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
- table "person_property_mutation_log_data" {
- order_by = ["team_id", "event_uuid"]
- partition_by = "toDate(ingested_at)"
- ttl = "ingested_at + toIntervalDay(30)"
- settings = {
- index_granularity = "1024"
- ttl_only_drop_parts = "1"
- }
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "replicated_replacing_merge_tree" {
- zoo_path = "/clickhouse/tables/noshard/posthog.person_property_mutation_log_data"
- replica_name = "{replica}-{shard}"
- version_column = "ingested_at"
- }
- }
-
table "property_values" {
order_by = ["team_id", "property_type", "property_key", "property_value"]
ttl = "last_seen + toIntervalDay(30)"
diff --git a/posthog/clickhouse/hcl/golden/prod-eu/data.hcl b/posthog/clickhouse/hcl/golden/prod-eu/data.hcl
index 44149986edea..6e29389aa76b 100644
--- a/posthog/clickhouse/hcl/golden/prod-eu/data.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-eu/data.hcl
@@ -3620,26 +3620,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
table "person_static_cohort" {
order_by = ["team_id", "cohort_id", "person_id", "id"]
settings = {
diff --git a/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl b/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl
index dfb065fe4942..8ed038f4545a 100644
--- a/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl
@@ -1120,53 +1120,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
- table "person_property_mutation_log_data" {
- order_by = ["team_id", "event_uuid"]
- partition_by = "toDate(ingested_at)"
- ttl = "ingested_at + toIntervalDay(30)"
- settings = {
- index_granularity = "1024"
- ttl_only_drop_parts = "1"
- }
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "replicated_replacing_merge_tree" {
- zoo_path = "/clickhouse/tables/noshard/posthog.person_property_mutation_log_data"
- replica_name = "{replica}-{shard}"
- version_column = "ingested_at"
- }
- }
-
table "property_values" {
order_by = ["team_id", "property_type", "property_key", "property_value"]
ttl = "last_seen + toIntervalDay(30)"
diff --git a/posthog/clickhouse/hcl/golden/prod-us/data.hcl b/posthog/clickhouse/hcl/golden/prod-us/data.hcl
index 63c4dd2069ab..91bf08854756 100644
--- a/posthog/clickhouse/hcl/golden/prod-us/data.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-us/data.hcl
@@ -3409,26 +3409,6 @@ database "posthog" {
}
}
- table "person_property_mutation_log" {
- column "team_id" {
- type = "Int64"
- }
- column "event_uuid" {
- type = "UUID"
- }
- column "properties" {
- type = "String"
- }
- column "ingested_at" {
- type = "DateTime('UTC')"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-
table "person_static_cohort" {
order_by = ["team_id", "cohort_id", "person_id", "id"]
settings = {
diff --git a/posthog/clickhouse/hcl/manifest.hcl b/posthog/clickhouse/hcl/manifest.hcl
index 7b27f9354121..6d9fdc8de6de 100644
--- a/posthog/clickhouse/hcl/manifest.hcl
+++ b/posthog/clickhouse/hcl/manifest.hcl
@@ -74,10 +74,10 @@ role "ai_events" {
# hosts the ingestion_warnings store; prod-us adds the Distributed proxy onto the data
# cluster. prod goldens are dump-baselined (not live-verifiable here).
role "aux" {
- env "local-multi" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/auxiliary/shared", "roles/auxiliary/local"] }
- env "dev" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/dev"] }
- env "prod-us" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-us"] }
- env "prod-eu" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-eu"] }
+ env "local-multi" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/auxiliary/shared", "roles/auxiliary/local"] }
+ env "dev" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/dev"] }
+ env "prod-us" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-us"] }
+ env "prod-eu" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-eu"] }
}
# SESSIONS satellite: the local node runs only the shared query_log_archive path
@@ -118,10 +118,10 @@ role "batch_exports" {
# columns per env that are added out-of-band and churn constantly, so their goldens
# live in PostHog/posthog-cloud-infra (clickhouse/hcl/), not the OSS gate.
role "data" {
- env "dev" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/ai_events_data", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/cloud", "roles/coshared/log_entries_write", "roles/data/dev"] }
- env "prod-us" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/ai_events_data", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/cloud", "roles/data/prod", "roles/data/prod-us"] }
- env "prod-eu" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/ai_events_data", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/cloud", "roles/coshared/log_entries_write", "roles/data/prod", "roles/data/prod-eu"] }
- env "local-multi" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/ai_events_data", "roles/coshared/tophog", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/batch_exports_data", "roles/coshared/ingestion_warnings_store", "roles/coshared/events_json_write", "roles/coshared/log_entries_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/local"] }
+ env "dev" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/ai_events_data", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/cloud", "roles/coshared/log_entries_write", "roles/data/dev"] }
+ env "prod-us" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/ai_events_data", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/cloud", "roles/data/prod", "roles/data/prod-us"] }
+ env "prod-eu" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/custom_metrics", "roles/coshared/ai_events_data", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/cloud", "roles/coshared/log_entries_write", "roles/data/prod", "roles/data/prod-eu"] }
+ env "local-multi" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/sessions_data", "roles/coshared/ai_events_data", "roles/coshared/tophog", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/batch_exports_data", "roles/coshared/ingestion_warnings_store", "roles/coshared/events_json_write", "roles/coshared/log_entries_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/local"] }
}
# INGESTION satellites: the Kafka consumer layer. Each node carries the kafka_* engine
@@ -130,7 +130,7 @@ role "data" {
# Beyond that they carry only the shared query_log_archive path. Role names are the
# hostClusterRole macros migrations target: events, small, medium.
role "events" {
- env "local-multi" { layers = ["roles/shared/qla.hcl", "roles/coshared/named_collections", "roles/coshared/logs_avro_ingest", "roles/coshared/events_json_write", "roles/coshared/person_property_mutations", "roles/ingestion_events/shared", "roles/ingestion_events/local"] }
+ env "local-multi" { layers = ["roles/shared/qla.hcl", "roles/coshared/named_collections", "roles/coshared/logs_avro_ingest", "roles/coshared/events_json_write", "roles/ingestion_events/local"] }
}
role "small" {
@@ -146,7 +146,7 @@ role "medium" {
# and not MULTINODE_CLICKHOUSE. Composed as the deduped union of the local-multi stacks it
# hosts, so any name two of those roles declare fails this load instead of drifting.
role "all" {
- env "local-single" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/apm_ingest", "roles/coshared/logs_avro_ingest", "roles/coshared/custom_metrics", "roles/ops/shared", "roles/ops/local", "roles/logs/base", "roles/logs/traces", "roles/logs/traces_kafka_metrics", "roles/logs/metrics", "roles/logs/local", "roles/apm/shared", "roles/apm/local", "roles/coshared/ai_events_data", "roles/ai_events/shared", "roles/ai_events/local", "roles/coshared/aux_data", "roles/coshared/person_property_mutations", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/auxiliary/shared", "roles/auxiliary/local", "roles/coshared/sessions_data", "roles/coshared/tophog", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/batch_exports_data", "roles/coshared/ingestion_warnings_store", "roles/coshared/events_json_write", "roles/coshared/log_entries_write", "roles/coshared/log_entries_aux_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/local", "roles/ingestion_events/shared", "roles/ingestion_events/local", "roles/ingestion_events/local-single", "roles/ingestion_small/local", "roles/ingestion_medium/local"] }
+ env "local-single" { layers = ["roles/shared", "roles/coshared/named_collections", "roles/coshared/apm_ingest", "roles/coshared/logs_avro_ingest", "roles/coshared/custom_metrics", "roles/ops/shared", "roles/ops/local", "roles/logs/base", "roles/logs/traces", "roles/logs/traces_kafka_metrics", "roles/logs/metrics", "roles/logs/local", "roles/apm/shared", "roles/apm/local", "roles/coshared/ai_events_data", "roles/ai_events/shared", "roles/ai_events/local", "roles/coshared/aux_data", "roles/coshared/log_entries_aux", "roles/coshared/aux_small", "roles/auxiliary/shared", "roles/auxiliary/local", "roles/coshared/sessions_data", "roles/coshared/tophog", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/batch_exports_data", "roles/coshared/ingestion_warnings_store", "roles/coshared/events_json_write", "roles/coshared/log_entries_write", "roles/coshared/log_entries_aux_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/common", "roles/data/local", "roles/ingestion_events/local", "roles/ingestion_events/local-single", "roles/ingestion_small/local", "roles/ingestion_medium/local"] }
}
# role "endpoints" {
diff --git a/posthog/clickhouse/hcl/roles/auxiliary/shared/person_property_mutations.hcl b/posthog/clickhouse/hcl/roles/auxiliary/shared/person_property_mutations.hcl
deleted file mode 100644
index 7864a9eed46d..000000000000
--- a/posthog/clickhouse/hcl/roles/auxiliary/shared/person_property_mutations.hcl
+++ /dev/null
@@ -1,14 +0,0 @@
-database "posthog" {
- table "person_property_mutation_log_data" {
- extend = "_person_property_mutation_log_columns"
- order_by = ["team_id", "event_uuid"]
- partition_by = "toDate(ingested_at)"
- ttl = "ingested_at + toIntervalDay(30)"
- settings = { index_granularity = "1024", ttl_only_drop_parts = "1" }
- engine "replicated_replacing_merge_tree" {
- zoo_path = "/clickhouse/tables/noshard/posthog.person_property_mutation_log_data"
- replica_name = "{replica}-{shard}"
- version_column = "ingested_at"
- }
- }
-}
diff --git a/posthog/clickhouse/hcl/roles/coshared/person_property_mutations/tables.hcl b/posthog/clickhouse/hcl/roles/coshared/person_property_mutations/tables.hcl
deleted file mode 100644
index 3d59e8cb80d7..000000000000
--- a/posthog/clickhouse/hcl/roles/coshared/person_property_mutations/tables.hcl
+++ /dev/null
@@ -1,17 +0,0 @@
-database "posthog" {
- table "_person_property_mutation_log_columns" {
- abstract = true
- column "team_id" { type = "Int64" }
- column "event_uuid" { type = "UUID" }
- column "properties" { type = "String" }
- column "ingested_at" { type = "DateTime('UTC')" }
- }
- table "person_property_mutation_log" {
- extend = "_person_property_mutation_log_columns"
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "person_property_mutation_log_data"
- }
- }
-}
diff --git a/posthog/clickhouse/hcl/roles/ingestion_events/shared/person_property_mutations.hcl b/posthog/clickhouse/hcl/roles/ingestion_events/shared/person_property_mutations.hcl
deleted file mode 100644
index 5138ccedd118..000000000000
--- a/posthog/clickhouse/hcl/roles/ingestion_events/shared/person_property_mutations.hcl
+++ /dev/null
@@ -1,22 +0,0 @@
-database "posthog" {
- table "kafka_person_property_mutation_log" {
- column "team_id" { type = "Int64" }
- column "uuid" { type = "UUID" }
- column "properties" { type = "String" }
- engine "kafka" {
- collection = "warpstream_ingestion"
- topic_list = "clickhouse_events_json"
- group_name = "clickhouse_person_property_mutation_log"
- format = "JSONEachRow"
- skip_broken_messages = 100
- }
- }
- materialized_view "person_property_mutation_log_mv" {
- to_table = "posthog.person_property_mutation_log"
- query = file("sql/person_property_mutation_log_mv.sql")
- column "team_id" { type = "Int64" }
- column "event_uuid" { type = "UUID" }
- column "properties" { type = "String" }
- column "ingested_at" { type = "DateTime('UTC')" }
- }
-}
diff --git a/posthog/clickhouse/hcl/roles/ingestion_events/shared/sql/person_property_mutation_log_mv.sql b/posthog/clickhouse/hcl/roles/ingestion_events/shared/sql/person_property_mutation_log_mv.sql
deleted file mode 100644
index bb0e6400dde9..000000000000
--- a/posthog/clickhouse/hcl/roles/ingestion_events/shared/sql/person_property_mutation_log_mv.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-SELECT
- team_id,
- uuid AS event_uuid,
- concat('{', arrayStringConcat(arrayMap(
- property -> concat(toJSONString(property.1), ':', property.2),
- arrayFilter(property -> property.1 IN ('$set', '$set_once', '$unset'),
- JSONExtractKeysAndValuesRaw(source.properties))
- ), ','), '}') AS properties,
- toDateTime(_timestamp, 'UTC') AS ingested_at
-FROM kafka_person_property_mutation_log AS source
-WHERE JSONHas(source.properties, '$set') OR JSONHas(source.properties, '$set_once') OR JSONHas(source.properties, '$unset')
diff --git a/posthog/clickhouse/hcl/sql/dev/auxiliary.sql b/posthog/clickhouse/hcl/sql/dev/auxiliary.sql
index 2dde5bad92d9..6cfc9a9ec514 100644
--- a/posthog/clickhouse/hcl/sql/dev/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/dev/auxiliary.sql
@@ -167,12 +167,6 @@ CREATE TABLE posthog.message_assets_data (
INDEX person_id_idx person_id TYPE bloom_filter(0.01) GRANULARITY 1,
INDEX recipient_idx recipient TYPE bloom_filter(0.01) GRANULARITY 1
) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.message_assets_data', '{replica}-{shard}', version) ORDER BY (team_id, function_kind, function_id, invocation_id, action_id) PARTITION BY toYYYYMMDD(sent_at) TTL toDate(sent_at) + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
-CREATE TABLE posthog.person_property_mutation_log_data (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_property_mutation_log_data', '{replica}-{shard}', ingested_at) ORDER BY (team_id, event_uuid) PARTITION BY toDate(ingested_at) TTL ingested_at + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
CREATE TABLE posthog.property_values (
team_id Int64 CODEC(DoubleDelta, ZSTD(1)),
property_type LowCardinality(String),
@@ -1228,12 +1222,6 @@ CREATE TABLE posthog.message_assets (
_offset UInt64,
_partition UInt64
) ENGINE = Distributed('aux', 'posthog', 'message_assets_data');
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.session_replay_features (
session_id String,
team_id Int64,
diff --git a/posthog/clickhouse/hcl/sql/dev/data.sql b/posthog/clickhouse/hcl/sql/dev/data.sql
index 3c6ba8013424..5cee1830570d 100644
--- a/posthog/clickhouse/hcl/sql/dev/data.sql
+++ b/posthog/clickhouse/hcl/sql/dev/data.sql
@@ -589,12 +589,6 @@ CREATE TABLE posthog.person_overrides (
created_at DateTime64(6, 'UTC') DEFAULT now(),
version Int32
) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_overrides', '{replica}-{shard}', version) ORDER BY (team_id, old_person_id) PARTITION BY toYYYYMM(oldest_event) SETTINGS index_granularity = 8192;
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.person_static_cohort (
id UUID,
person_id UUID,
diff --git a/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql b/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql
index a05e3c938810..7d0caf9e65e1 100644
--- a/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql
@@ -181,12 +181,6 @@ CREATE TABLE posthog.message_assets_data (
INDEX person_id_idx person_id TYPE bloom_filter(0.01) GRANULARITY 1,
INDEX recipient_idx recipient TYPE bloom_filter(0.01) GRANULARITY 1
) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.message_assets_data', '{replica}-{shard}', version) ORDER BY (team_id, function_kind, function_id, invocation_id, action_id) PARTITION BY toYYYYMMDD(sent_at) TTL toDate(sent_at) + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
-CREATE TABLE posthog.person_property_mutation_log_data (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_property_mutation_log_data', '{replica}-{shard}', ingested_at) ORDER BY (team_id, event_uuid) PARTITION BY toDate(ingested_at) TTL ingested_at + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
CREATE TABLE posthog.property_values (
team_id Int64 CODEC(DoubleDelta, ZSTD(1)),
property_type LowCardinality(String),
@@ -1249,12 +1243,6 @@ CREATE TABLE posthog.message_assets (
_offset UInt64,
_partition UInt64
) ENGINE = Distributed('aux', 'posthog', 'message_assets_data');
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.session_replay_features (
session_id String,
team_id Int64,
diff --git a/posthog/clickhouse/hcl/sql/local-multi/data.sql b/posthog/clickhouse/hcl/sql/local-multi/data.sql
index 1b4f953509a9..d5bc2b3fbafe 100644
--- a/posthog/clickhouse/hcl/sql/local-multi/data.sql
+++ b/posthog/clickhouse/hcl/sql/local-multi/data.sql
@@ -613,12 +613,6 @@ CREATE TABLE posthog.person_overrides (
created_at DateTime64(6, 'UTC') DEFAULT now(),
version Int32
) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_overrides', '{replica}-{shard}', version) ORDER BY (team_id, old_person_id) PARTITION BY toYYYYMM(oldest_event) SETTINGS index_granularity = 8192;
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.person_static_cohort (
id UUID,
person_id UUID,
diff --git a/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sql b/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sql
index 503e421f88dc..868a0619924b 100644
--- a/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sql
+++ b/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sql
@@ -56,17 +56,6 @@ CREATE TABLE posthog.kafka_logs_avro (
pattern Nullable(String),
pattern_version Nullable(Int32)
) ENGINE = Kafka(warpstream_logs) SETTINGS input_format_avro_allow_missing_fields = 1, kafka_format = 'Avro', kafka_group_name = 'clickhouse-logs-avro-new', kafka_num_consumers = 1, kafka_poll_max_batch_size = 1000, kafka_poll_timeout_ms = 3000, kafka_skip_broken_messages = 100, kafka_thread_per_consumer = 1, kafka_topic_list = 'clickhouse_logs';
-CREATE TABLE posthog.kafka_person_property_mutation_log (
- team_id Int64,
- uuid UUID,
- properties String
-) ENGINE = Kafka(warpstream_ingestion) SETTINGS kafka_format = 'JSONEachRow', kafka_group_name = 'clickhouse_person_property_mutation_log', kafka_skip_broken_messages = 100, kafka_topic_list = 'clickhouse_events_json';
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.query_log_archive (
hostname LowCardinality(String),
user LowCardinality(String),
@@ -325,28 +314,3 @@ CREATE MATERIALIZED VIEW posthog.kafka_logs34_avro_mv TO posthog.writable_logs34
ifNull(pattern, '') AS pattern,
toUInt8(ifNull(pattern_version, 0)) AS pattern_version
FROM posthog.kafka_logs_avro;
-CREATE MATERIALIZED VIEW posthog.person_property_mutation_log_mv TO posthog.person_property_mutation_log (team_id Int64, event_uuid UUID, properties String, ingested_at DateTime('UTC')) AS SELECT
- team_id,
- uuid AS event_uuid,
- concat(
- '{',
- arrayStringConcat(
- arrayMap(
- property -> concat(toJSONString(property.1), ':', property.2),
- arrayFilter(
- property -> property.1 IN ('$set', '$set_once', '$unset'),
- JSONExtractKeysAndValuesRaw(source.properties)
- )
- ),
- ','
- ),
- '}'
- ) AS properties,
- toDateTime(_timestamp, 'UTC') AS ingested_at
-FROM kafka_person_property_mutation_log AS source
-WHERE
- JSONHas(source.properties, '$set')
-OR
- JSONHas(source.properties, '$set_once')
-OR
- JSONHas(source.properties, '$unset');
diff --git a/posthog/clickhouse/hcl/sql/local-single/all.sql b/posthog/clickhouse/hcl/sql/local-single/all.sql
index 80744b58f6cb..b5ea01d5ba07 100644
--- a/posthog/clickhouse/hcl/sql/local-single/all.sql
+++ b/posthog/clickhouse/hcl/sql/local-single/all.sql
@@ -757,11 +757,6 @@ CREATE TABLE posthog.kafka_person_overrides (
oldest_event DateTime64(6, 'UTC'),
version Int32
) ENGINE = Kafka() SETTINGS kafka_broker_list = 'kafka:9092', kafka_format = 'JSONEachRow', kafka_group_name = 'clickhouse-person-overrides', kafka_topic_list = 'clickhouse_person_override';
-CREATE TABLE posthog.kafka_person_property_mutation_log (
- team_id Int64,
- uuid UUID,
- properties String
-) ENGINE = Kafka(warpstream_ingestion) SETTINGS kafka_format = 'JSONEachRow', kafka_group_name = 'clickhouse_person_property_mutation_log', kafka_skip_broken_messages = 100, kafka_topic_list = 'clickhouse_events_json';
CREATE TABLE posthog.kafka_plugin_log_entries (
id UUID,
team_id Int64,
@@ -1776,12 +1771,6 @@ CREATE TABLE posthog.person_overrides (
created_at DateTime64(6, 'UTC') DEFAULT now(),
version Int32
) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_overrides', '{replica}-{shard}', version) ORDER BY (team_id, old_person_id) PARTITION BY toYYYYMM(oldest_event) SETTINGS index_granularity = 8192;
-CREATE TABLE posthog.person_property_mutation_log_data (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_property_mutation_log_data', '{replica}-{shard}', ingested_at) ORDER BY (team_id, event_uuid) PARTITION BY toDate(ingested_at) TTL ingested_at + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
CREATE TABLE posthog.person_static_cohort (
id UUID,
person_id UUID,
@@ -7139,12 +7128,6 @@ CREATE TABLE posthog.performance_events (
_offset UInt64,
_partition UInt64
) ENGINE = Distributed('posthog', 'posthog', 'sharded_performance_events', sipHash64(session_id));
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.preaggregation_results (
team_id Int64,
job_id UUID,
@@ -7699,31 +7682,6 @@ CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_qu
ProfileEvents
FROM system.query_log
WHERE type != 'QueryStart';
-CREATE MATERIALIZED VIEW posthog.person_property_mutation_log_mv TO posthog.person_property_mutation_log (team_id Int64, event_uuid UUID, properties String, ingested_at DateTime('UTC')) AS SELECT
- team_id,
- uuid AS event_uuid,
- concat(
- '{',
- arrayStringConcat(
- arrayMap(
- property -> concat(toJSONString(property.1), ':', property.2),
- arrayFilter(
- property -> property.1 IN ('$set', '$set_once', '$unset'),
- JSONExtractKeysAndValuesRaw(source.properties)
- )
- ),
- ','
- ),
- '}'
- ) AS properties,
- toDateTime(_timestamp, 'UTC') AS ingested_at
-FROM kafka_person_property_mutation_log AS source
-WHERE
- JSONHas(source.properties, '$set')
-OR
- JSONHas(source.properties, '$set_once')
-OR
- JSONHas(source.properties, '$unset');
CREATE VIEW posthog.custom_metrics AS SELECT * REPLACE(toFloat64(value) AS value)
FROM posthog.custom_metrics_test
UNION ALL
diff --git a/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql b/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql
index ca986f68b405..e5a4d456a442 100644
--- a/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql
@@ -167,12 +167,6 @@ CREATE TABLE posthog.message_assets_data (
INDEX person_id_idx person_id TYPE bloom_filter(0.01) GRANULARITY 1,
INDEX recipient_idx recipient TYPE bloom_filter(0.01) GRANULARITY 1
) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.message_assets_data', '{replica}-{shard}', version) ORDER BY (team_id, function_kind, function_id, invocation_id, action_id) PARTITION BY toYYYYMMDD(sent_at) TTL toDate(sent_at) + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
-CREATE TABLE posthog.person_property_mutation_log_data (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_property_mutation_log_data', '{replica}-{shard}', ingested_at) ORDER BY (team_id, event_uuid) PARTITION BY toDate(ingested_at) TTL ingested_at + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
CREATE TABLE posthog.property_values (
team_id Int64 CODEC(DoubleDelta, ZSTD(1)),
property_type LowCardinality(String),
@@ -1228,12 +1222,6 @@ CREATE TABLE posthog.message_assets (
_offset UInt64,
_partition UInt64
) ENGINE = Distributed('aux', 'posthog', 'message_assets_data');
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.session_replay_features (
session_id String,
team_id Int64,
diff --git a/posthog/clickhouse/hcl/sql/prod-eu/data.sql b/posthog/clickhouse/hcl/sql/prod-eu/data.sql
index 388268436dff..67e0455564db 100644
--- a/posthog/clickhouse/hcl/sql/prod-eu/data.sql
+++ b/posthog/clickhouse/hcl/sql/prod-eu/data.sql
@@ -862,12 +862,6 @@ CREATE TABLE posthog.person_overrides_to_delete (
distinct_id String,
partitions Array(String)
) ENGINE = Join(ANY, LEFT, team_id, distinct_id);
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.person_static_cohort (
id UUID,
person_id UUID,
diff --git a/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql b/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql
index 2d954a451260..4e4f867005ee 100644
--- a/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql
@@ -167,12 +167,6 @@ CREATE TABLE posthog.message_assets_data (
INDEX person_id_idx person_id TYPE bloom_filter(0.01) GRANULARITY 1,
INDEX recipient_idx recipient TYPE bloom_filter(0.01) GRANULARITY 1
) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.message_assets_data', '{replica}-{shard}', version) ORDER BY (team_id, function_kind, function_id, invocation_id, action_id) PARTITION BY toYYYYMMDD(sent_at) TTL toDate(sent_at) + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
-CREATE TABLE posthog.person_property_mutation_log_data (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/noshard/posthog.person_property_mutation_log_data', '{replica}-{shard}', ingested_at) ORDER BY (team_id, event_uuid) PARTITION BY toDate(ingested_at) TTL ingested_at + toIntervalDay(30) SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1;
CREATE TABLE posthog.property_values (
team_id Int64 CODEC(DoubleDelta, ZSTD(1)),
property_type LowCardinality(String),
@@ -1238,12 +1232,6 @@ CREATE TABLE posthog.message_assets (
_offset UInt64,
_partition UInt64
) ENGINE = Distributed('aux', 'posthog', 'message_assets_data');
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.session_replay_features (
session_id String,
team_id Int64,
diff --git a/posthog/clickhouse/hcl/sql/prod-us/data.sql b/posthog/clickhouse/hcl/sql/prod-us/data.sql
index 73e55df9fe42..fe4478e6ba78 100644
--- a/posthog/clickhouse/hcl/sql/prod-us/data.sql
+++ b/posthog/clickhouse/hcl/sql/prod-us/data.sql
@@ -731,12 +731,6 @@ CREATE TABLE posthog.person_overrides_to_delete (
distinct_id String,
partitions Array(String)
) ENGINE = Join(ANY, LEFT, team_id, distinct_id);
-CREATE TABLE posthog.person_property_mutation_log (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-) ENGINE = Distributed('aux', 'posthog', 'person_property_mutation_log_data');
CREATE TABLE posthog.person_static_cohort (
id UUID,
person_id UUID,
diff --git a/posthog/clickhouse/migrations/0318_person_property_mutation_log.py b/posthog/clickhouse/migrations/0318_person_property_mutation_log.py
index 7d4b0db87caa..feb7e7a2c4fb 100644
--- a/posthog/clickhouse/migrations/0318_person_property_mutation_log.py
+++ b/posthog/clickhouse/migrations/0318_person_property_mutation_log.py
@@ -1,17 +1,3 @@
-from posthog.clickhouse.client.connection import NodeRole
-from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions
-from posthog.models.event.person_property_mutation_sql import (
- PERSON_PROPERTY_MUTATION_LOG_DATA_TABLE_SQL,
- PERSON_PROPERTY_MUTATION_LOG_KAFKA_TABLE_SQL,
- PERSON_PROPERTY_MUTATION_LOG_MV_SQL,
- PERSON_PROPERTY_MUTATION_LOG_TABLE_SQL,
-)
+# No-op so fresh environments don't create tables that 0338 drops.
-operations = [
- run_sql_with_exceptions(PERSON_PROPERTY_MUTATION_LOG_DATA_TABLE_SQL(), node_roles=[NodeRole.AUX]),
- run_sql_with_exceptions(
- PERSON_PROPERTY_MUTATION_LOG_TABLE_SQL(), node_roles=[NodeRole.AUX, NodeRole.DATA, NodeRole.INGESTION_EVENTS]
- ),
- run_sql_with_exceptions(PERSON_PROPERTY_MUTATION_LOG_KAFKA_TABLE_SQL(), node_roles=[NodeRole.INGESTION_EVENTS]),
- run_sql_with_exceptions(PERSON_PROPERTY_MUTATION_LOG_MV_SQL(), node_roles=[NodeRole.INGESTION_EVENTS]),
-]
+operations: list = []
diff --git a/posthog/clickhouse/migrations/0338_drop_person_property_mutation_log.py b/posthog/clickhouse/migrations/0338_drop_person_property_mutation_log.py
new file mode 100644
index 000000000000..703a29b753d4
--- /dev/null
+++ b/posthog/clickhouse/migrations/0338_drop_person_property_mutation_log.py
@@ -0,0 +1,24 @@
+from posthog.clickhouse.client.connection import NodeRole
+from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions
+
+# Writers go first (MV, then Kafka table) so no insert targets a dropped table, then the
+# Distributed proxy, then the aux storage table. The storage table exceeds the server's
+# max_table_size_to_drop, so the drop overrides it per query.
+operations = [
+ run_sql_with_exceptions(
+ "DROP TABLE IF EXISTS person_property_mutation_log_mv",
+ node_roles=[NodeRole.INGESTION_EVENTS],
+ ),
+ run_sql_with_exceptions(
+ "DROP TABLE IF EXISTS kafka_person_property_mutation_log",
+ node_roles=[NodeRole.INGESTION_EVENTS],
+ ),
+ run_sql_with_exceptions(
+ "DROP TABLE IF EXISTS person_property_mutation_log",
+ node_roles=[NodeRole.AUX, NodeRole.DATA, NodeRole.INGESTION_EVENTS],
+ ),
+ run_sql_with_exceptions(
+ "DROP TABLE IF EXISTS person_property_mutation_log_data SETTINGS max_table_size_to_drop = 0",
+ node_roles=[NodeRole.AUX],
+ ),
+]
diff --git a/posthog/clickhouse/migrations/max_migration.txt b/posthog/clickhouse/migrations/max_migration.txt
index 5b754f130a71..2ca49bab44b4 100644
--- a/posthog/clickhouse/migrations/max_migration.txt
+++ b/posthog/clickhouse/migrations/max_migration.txt
@@ -1 +1 @@
-0337_query_log_archive_cost_planner_aliases
+0338_drop_person_property_mutation_log
diff --git a/posthog/clickhouse/schema.py b/posthog/clickhouse/schema.py
index 613a8072161a..20790058ed29 100644
--- a/posthog/clickhouse/schema.py
+++ b/posthog/clickhouse/schema.py
@@ -222,12 +222,6 @@ from posthog.models.dmat_slot_assignments.sql import (
DMAT_SLOT_ASSIGNMENTS_DICTIONARY_SQL,
DMAT_SLOT_ASSIGNMENTS_TABLE_SQL,
)
-from posthog.models.event.person_property_mutation_sql import (
- PERSON_PROPERTY_MUTATION_LOG_DATA_TABLE_SQL,
- PERSON_PROPERTY_MUTATION_LOG_KAFKA_TABLE_SQL,
- PERSON_PROPERTY_MUTATION_LOG_MV_SQL,
- PERSON_PROPERTY_MUTATION_LOG_TABLE_SQL,
-)
from posthog.models.event.sql import (
DISTRIBUTED_EVENTS_JSON_TABLE_SQL,
DISTRIBUTED_EVENTS_RECENT_TABLE_SQL,
@@ -417,7 +411,6 @@ from products.event_definitions.backend.models.property_definition import PROPER
# Queries to create tables, you must pass function, otherwise the table is created before
# objects are mocked and the ambr will go into infinite loop update.
CREATE_MERGETREE_TABLE_QUERIES = (
- PERSON_PROPERTY_MUTATION_LOG_DATA_TABLE_SQL,
LOG_ENTRIES_TABLE_SQL,
LOG_ENTRIES_DATA_TABLE_SQL,
CREATE_COHORTPEOPLE_TABLE_SQL,
@@ -516,7 +509,6 @@ CREATE_MERGETREE_TABLE_QUERIES = (
DMAT_SLOT_ASSIGNMENTS_TABLE_SQL,
)
CREATE_DISTRIBUTED_TABLE_QUERIES = (
- PERSON_PROPERTY_MUTATION_LOG_TABLE_SQL,
LOG_ENTRIES_AUX_DISTRIBUTED_TABLE_SQL,
LOG_ENTRIES_AUX_WRITABLE_TABLE_SQL,
WRITABLE_EVENTS_TABLE_SQL,
@@ -615,7 +607,6 @@ CREATE_DISTRIBUTED_TABLE_QUERIES = (
DISTRIBUTED_PROPERTY_VALUES_TABLE_SQL,
)
CREATE_KAFKA_TABLE_QUERIES = (
- PERSON_PROPERTY_MUTATION_LOG_KAFKA_TABLE_SQL,
KAFKA_LOG_ENTRIES_TABLE_SQL,
KAFKA_LOG_ENTRIES_AUX_TABLE_SQL,
KAFKA_DEAD_LETTER_QUEUE_TABLE_SQL,
@@ -653,7 +644,6 @@ CREATE_KAFKA_TABLE_QUERIES = (
KAFKA_METRICS_AVRO4_TABLE_SQL,
)
CREATE_MV_TABLE_QUERIES = (
- PERSON_PROPERTY_MUTATION_LOG_MV_SQL,
LOG_ENTRIES_TABLE_MV_SQL,
LOG_ENTRIES_AUX_MV_SQL,
DEAD_LETTER_QUEUE_TABLE_MV_SQL,
diff --git a/posthog/clickhouse/test/__snapshots__/test_schema.ambr b/posthog/clickhouse/test/__snapshots__/test_schema.ambr
index b33276d3234b..21abc1611246 100644
--- a/posthog/clickhouse/test/__snapshots__/test_schema.ambr
+++ b/posthog/clickhouse/test/__snapshots__/test_schema.ambr
@@ -728,20 +728,6 @@
'''
# ---
-# name: test_create_kafka_table_with_different_kafka_host[kafka_person_property_mutation_log]
- '''
-
- CREATE TABLE IF NOT EXISTS kafka_person_property_mutation_log
- (
- team_id Int64,
- uuid UUID,
- properties String
- )
- ENGINE = Kafka(warpstream_ingestion, kafka_topic_list = 'clickhouse_events_json_test', kafka_group_name = 'clickhouse_person_property_mutation_log', kafka_format = 'JSONEachRow')
- SETTINGS kafka_skip_broken_messages = 100
-
- '''
-# ---
# name: test_create_kafka_table_with_different_kafka_host[kafka_plugin_log_entries]
'''
@@ -3171,20 +3157,6 @@
'''
# ---
-# name: test_create_table_query[kafka_person_property_mutation_log]
- '''
-
- CREATE TABLE IF NOT EXISTS kafka_person_property_mutation_log
- (
- team_id Int64,
- uuid UUID,
- properties String
- )
- ENGINE = Kafka(warpstream_ingestion, kafka_topic_list = 'clickhouse_events_json_test', kafka_group_name = 'clickhouse_person_property_mutation_log', kafka_format = 'JSONEachRow')
- SETTINGS kafka_skip_broken_messages = 100
-
- '''
-# ---
# name: test_create_table_query[kafka_plugin_log_entries]
'''
@@ -5883,57 +5855,6 @@
'''
# ---
-# name: test_create_table_query[person_property_mutation_log]
- '''
-
- CREATE TABLE IF NOT EXISTS person_property_mutation_log
- (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
- )
- ENGINE = Distributed('aux', 'posthog_test', 'person_property_mutation_log_data')
-
- '''
-# ---
-# name: test_create_table_query[person_property_mutation_log_data]
- '''
-
- CREATE TABLE IF NOT EXISTS person_property_mutation_log_data
- (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
- )
- ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_noshard/posthog.person_property_mutation_log_data', '{replica}-{shard}', ingested_at)
- PARTITION BY toDate(ingested_at)
- ORDER BY (team_id, event_uuid)
- TTL ingested_at + INTERVAL 30 DAY
- SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1
-
- '''
-# ---
-# name: test_create_table_query[person_property_mutation_log_mv]
- '''
-
- CREATE MATERIALIZED VIEW IF NOT EXISTS person_property_mutation_log_mv
- TO person_property_mutation_log
- AS SELECT
- team_id,
- uuid AS event_uuid,
- concat('{', arrayStringConcat(arrayMap(
- property -> concat(toJSONString(property.1), ':', property.2),
- arrayFilter(property -> property.1 IN ('$set', '$set_once', '$unset'),
- JSONExtractKeysAndValuesRaw(source.properties))
- ), ','), '}') AS properties,
- toDateTime(_timestamp, 'UTC') AS ingested_at
- FROM kafka_person_property_mutation_log AS source
- WHERE JSONHas(source.properties, '$set') OR JSONHas(source.properties, '$set_once') OR JSONHas(source.properties, '$unset')
-
- '''
-# ---
# name: test_create_table_query[person_static_cohort]
'''
@@ -13011,24 +12932,6 @@
'''
# ---
-# name: test_create_table_query_replicated_and_storage[person_property_mutation_log_data]
- '''
-
- CREATE TABLE IF NOT EXISTS person_property_mutation_log_data
- (
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
- )
- ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_noshard/posthog.person_property_mutation_log_data', '{replica}-{shard}', ingested_at)
- PARTITION BY toDate(ingested_at)
- ORDER BY (team_id, event_uuid)
- TTL ingested_at + INTERVAL 30 DAY
- SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1
-
- '''
-# ---
# name: test_create_table_query_replicated_and_storage[person_static_cohort]
'''
diff --git a/posthog/clickhouse/test/test_schema.py b/posthog/clickhouse/test/test_schema.py
index a79bc7f4251a..842074f6bc11 100644
--- a/posthog/clickhouse/test/test_schema.py
+++ b/posthog/clickhouse/test/test_schema.py
@@ -1,5 +1,4 @@
import re
-import json
import uuid
from collections.abc import Iterator
from datetime import UTC, datetime, timedelta
@@ -23,7 +22,6 @@ from posthog.clickhouse.schema import (
build_query,
get_table_name,
)
-from posthog.models.event.person_property_mutation_sql import PERSON_PROPERTY_MUTATION_LOG_MV_SQL
from posthog.models.event.sql import (
EVENTS_JSON_TABLE_MV_SQL,
KAFKA_EVENTS_NATIVE_JSON_TABLE,
@@ -78,44 +76,6 @@ def test_events_json_table_uses_dedicated_kafka_consumer_group(settings):
assert "accurateCastOrNull(if(isValidJSON(source.person_properties)" in mv_query
- "properties,expected",
- [
- (
- {
- "$set": {"nested": {"values": [True, None, 42, "雪"]}},
- "$set_once": {"first": False},
- "$unset": ["old"],
- "ordinary": "discard",
- },
- {"$set": {"nested": {"values": [True, None, 42, "雪"]}}, "$set_once": {"first": False}, "$unset": ["old"]},
- ),
- ({"$unset": ["old"]}, {"$unset": ["old"]}),
- ({"$unset": {"old": True}}, {"$unset": {"old": True}}),
- ({"$set_once": {"first": 0}}, {"$set_once": {"first": 0}}),
- ({"ordinary": "discard"}, None),
- ],
-)
[email protected]("clickhouse_database")
-def test_person_property_mutation_projection(properties: dict[str, object], expected: dict[str, object] | None) -> None:
- select = PERSON_PROPERTY_MUTATION_LOG_MV_SQL().split("AS SELECT", 1)[1]
- rows = sync_execute(
- """
- WITH kafka_person_property_mutation_log AS (
- SELECT 42 AS team_id,
- toUUID('0192a5c8-0000-0000-0000-000000000000') AS uuid,
- %(properties)s AS properties,
- now() AS _timestamp
- )
- SELECT """
- + select,
- {"properties": json.dumps(properties)},
- team_id=42,
- flush=False,
- )
- assert [json.loads(row[2]) for row in rows] == ([] if expected is None else [expected])
-
-
@pytest.mark.parametrize(
"timestamp_offset,observed_delay,retentions,expected_days",
[
diff --git a/posthog/models/deletion_targets.py b/posthog/models/deletion_targets.py
index e8443974df21..c144a038167e 100644
--- a/posthog/models/deletion_targets.py
+++ b/posthog/models/deletion_targets.py
@@ -240,7 +240,7 @@ PERSON_ID_REWRITE_EXEMPT: frozenset[str] = frozenset({EVENTS_JSON_DATA_TABLE})
# sharded_events_recent is a transient mirror of the last few days of events, on a 7-day TTL keyed
# on inserted_at. Seven days is a short enough window to accept as the erasure bound, and a sweep
# would race the TTL for little benefit.
-TTL_ONLY_TABLES: frozenset[str] = frozenset({SHARDED_EVENTS_RECENT_DATA_TABLE(), "person_property_mutation_log_data"})
+TTL_ONLY_TABLES: frozenset[str] = frozenset({SHARDED_EVENTS_RECENT_DATA_TABLE()})
_TABLE_EXISTS_SQL = "SELECT count() FROM system.tables WHERE database = %(database)s AND name = %(name)s"
diff --git a/posthog/models/event/person_property_mutation_sql.py b/posthog/models/event/person_property_mutation_sql.py
deleted file mode 100644
index d77ddc979dcf..000000000000
--- a/posthog/models/event/person_property_mutation_sql.py
+++ /dev/null
@@ -1,63 +0,0 @@
-from django.conf import settings
-
-from posthog.clickhouse.kafka_engine import kafka_engine
-from posthog.clickhouse.table_engines import Distributed, ReplacingMergeTree
-from posthog.kafka_client.topics import KAFKA_EVENTS_JSON
-
-PERSON_PROPERTY_MUTATION_COLUMNS = """
- team_id Int64,
- event_uuid UUID,
- properties String,
- ingested_at DateTime('UTC')
-"""
-
-
-def PERSON_PROPERTY_MUTATION_LOG_DATA_TABLE_SQL() -> str:
- return f"""
-CREATE TABLE IF NOT EXISTS person_property_mutation_log_data
-({PERSON_PROPERTY_MUTATION_COLUMNS})
-ENGINE = {ReplacingMergeTree("person_property_mutation_log_data", ver="ingested_at")}
-PARTITION BY toDate(ingested_at)
-ORDER BY (team_id, event_uuid)
-TTL ingested_at + INTERVAL 30 DAY
-SETTINGS index_granularity = 1024, ttl_only_drop_parts = 1
-"""
-
-
-def PERSON_PROPERTY_MUTATION_LOG_TABLE_SQL() -> str:
- return f"""
-CREATE TABLE IF NOT EXISTS person_property_mutation_log
-({PERSON_PROPERTY_MUTATION_COLUMNS})
-ENGINE = {Distributed(data_table="person_property_mutation_log_data", cluster=settings.CLICKHOUSE_AUX_CLUSTER)}
-"""
-
-
-def PERSON_PROPERTY_MUTATION_LOG_KAFKA_TABLE_SQL() -> str:
- return f"""
-CREATE TABLE IF NOT EXISTS kafka_person_property_mutation_log
-(
- team_id Int64,
- uuid UUID,
- properties String
-)
-ENGINE = {kafka_engine(topic=KAFKA_EVENTS_JSON, group="clickhouse_person_property_mutation_log", named_collection=settings.CLICKHOUSE_KAFKA_WARPSTREAM_INGESTION_NAMED_COLLECTION)}
-SETTINGS kafka_skip_broken_messages = 100
-"""
-
-
-def PERSON_PROPERTY_MUTATION_LOG_MV_SQL() -> str:
- return """
-CREATE MATERIALIZED VIEW IF NOT EXISTS person_property_mutation_log_mv
-TO person_property_mutation_log
-AS SELECT
- team_id,
- uuid AS event_uuid,
- concat('{', arrayStringConcat(arrayMap(
- property -> concat(toJSONString(property.1), ':', property.2),
- arrayFilter(property -> property.1 IN ('$set', '$set_once', '$unset'),
- JSONExtractKeysAndValuesRaw(source.properties))
- ), ','), '}') AS properties,
- toDateTime(_timestamp, 'UTC') AS ingested_at
-FROM kafka_person_property_mutation_log AS source
-WHERE JSONHas(source.properties, '$set') OR JSONHas(source.properties, '$set_once') OR JSONHas(source.properties, '$unset')
-"""