: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(flags): drop unused property columns from flag_evaluations (#97027)
Phil Haack30bc8f8fd48f
diff --git a/docs/internal/clickhouse-deletion-coverage.md b/docs/internal/clickhouse-deletion-coverage.mdindex d4f5ef5f5a52..465480d4010e 100644--- a/docs/internal/clickhouse-deletion-coverage.md+++ b/docs/internal/clickhouse-deletion-coverage.md@@ -103,7 +103,8 @@ That decision predates this document; the older `posthog/models/async_deletion/d### Property removal does not reach `flag_evaluations`-The ingestion mapper omits `person_properties` and `group0..group4_properties` from flag-evaluation rows. ClickHouse fills these omitted string columns with empty values; existing rows keep their stored values. Event `properties` and `person_id` are still sent.+`person_properties` and `group0..group4_properties` no longer exist on the table: no Insight or Hog function used either as a breakdown or a filter, so the ClickHouse team dropped them directly on both prod clusters, and `posthog/models/flag_evaluations/sql.py` no longer declares them, so any environment built from the migrations matches. Event `properties` and `person_id` are still sent.+Because the table can no longer hold person properties, only the event-`properties` half of a request can match rows here.The events property-removal path rewrites rows in a staging table and resets each affected materialized column with `ALTER TABLE … UPDATE <col> = ''`.That works because `materialize()` creates columns as `DEFAULT <expr>`, which is assignable.diff --git a/posthog/clickhouse/hcl/golden/dev/data.hcl b/posthog/clickhouse/hcl/golden/dev/data.hclindex b82a31b8987f..74292d7233f8 100644--- a/posthog/clickhouse/hcl/golden/dev/data.hcl+++ b/posthog/clickhouse/hcl/golden/dev/data.hcl@@ -1816,24 +1816,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"@@ -5510,24 +5492,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"diff --git a/posthog/clickhouse/hcl/golden/local-multi/data.hcl b/posthog/clickhouse/hcl/golden/local-multi/data.hclindex 9fd4d10be524..27ada547203d 100644--- a/posthog/clickhouse/hcl/golden/local-multi/data.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/data.hcl@@ -1885,24 +1885,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"@@ -6311,24 +6293,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"diff --git a/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hcl b/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hclindex 29257331fd74..ffcbdab1910b 100644--- a/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hcl@@ -142,24 +142,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"}@@ -1043,24 +1025,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"@@ -1628,12 +1592,6 @@ SELECTdistinct_id,created_at,person_id,- person_properties,- group0_properties,- group1_properties,- group2_properties,- group3_properties,- group4_properties,if(inserted_at = toDateTime64('1970-01-01 00:00:00', 6, 'UTC'), _timestamp, inserted_at) AS inserted_at,_timestamp,_offset,@@ -1665,24 +1623,6 @@ SQLcolumn "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "Nullable(DateTime64(6, 'UTC'))"}diff --git a/posthog/clickhouse/hcl/golden/local-single/all.hcl b/posthog/clickhouse/hcl/golden/local-single/all.hclindex 193856a9b8c9..b5a6d303f538 100644--- a/posthog/clickhouse/hcl/golden/local-single/all.hcl+++ b/posthog/clickhouse/hcl/golden/local-single/all.hcl@@ -1965,24 +1965,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"@@ -3190,24 +3172,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"}@@ -11433,24 +11397,6 @@ SQLcolumn "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"@@ -16806,24 +16752,6 @@ SQLcolumn "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"@@ -19911,12 +19839,6 @@ SELECTdistinct_id,created_at,person_id,- person_properties,- group0_properties,- group1_properties,- group2_properties,- group3_properties,- group4_properties,if(inserted_at = toDateTime64('1970-01-01 00:00:00', 6, 'UTC'), _timestamp, inserted_at) AS inserted_at,_timestamp,_offset,@@ -19948,24 +19870,6 @@ SQLcolumn "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "Nullable(DateTime64(6, 'UTC'))"}diff --git a/posthog/clickhouse/hcl/roles/data/prod/tables.hcl b/posthog/clickhouse/hcl/roles/data/prod/tables.hclindex dc7a42f39105..afcaf947994c 100644--- a/posthog/clickhouse/hcl/roles/data/prod/tables.hcl+++ b/posthog/clickhouse/hcl/roles/data/prod/tables.hcl@@ -316,13 +316,4 @@ database "posthog" {}}- # Both prod clusters dropped the person and group property columns from the flag- # evaluation tables. dev and the local node still carry them.- patch_table "flag_evaluations" {- drop_columns = ["group0_properties", "group1_properties", "group2_properties", "group3_properties", "group4_properties", "person_properties"]- }-- patch_table "sharded_flag_evaluations" {- drop_columns = ["group0_properties", "group1_properties", "group2_properties", "group3_properties", "group4_properties", "person_properties"]- }}diff --git a/posthog/clickhouse/hcl/roles/data/shared/flag_evaluations.hcl b/posthog/clickhouse/hcl/roles/data/shared/flag_evaluations.hclindex 97b76cfe58ba..812b63242add 100644--- a/posthog/clickhouse/hcl/roles/data/shared/flag_evaluations.hcl+++ b/posthog/clickhouse/hcl/roles/data/shared/flag_evaluations.hcl@@ -33,24 +33,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"diff --git a/posthog/clickhouse/hcl/roles/ingestion_medium/local/tables.hcl b/posthog/clickhouse/hcl/roles/ingestion_medium/local/tables.hclindex 545fb214d4b4..dad2028c9d2c 100644--- a/posthog/clickhouse/hcl/roles/ingestion_medium/local/tables.hcl+++ b/posthog/clickhouse/hcl/roles/ingestion_medium/local/tables.hcl@@ -142,24 +142,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"}@@ -694,24 +676,6 @@ database "posthog" {column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "DateTime64(6, 'UTC')"default = "timestamp"@@ -1279,12 +1243,6 @@ SELECTdistinct_id,created_at,person_id,- person_properties,- group0_properties,- group1_properties,- group2_properties,- group3_properties,- group4_properties,if(inserted_at = toDateTime64('1970-01-01 00:00:00', 6, 'UTC'), _timestamp, inserted_at) AS inserted_at,_timestamp,_offset,@@ -1316,24 +1274,6 @@ SQLcolumn "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }column "inserted_at" {type = "Nullable(DateTime64(6, 'UTC'))"}diff --git a/posthog/clickhouse/hcl/sql/dev/data.sql b/posthog/clickhouse/hcl/sql/dev/data.sqlindex 53fd40c75e84..6835cafc5dcc 100644--- a/posthog/clickhouse/hcl/sql/dev/data.sql+++ b/posthog/clickhouse/hcl/sql/dev/data.sql@@ -1105,12 +1105,6 @@ CREATE TABLE posthog.sharded_flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,$group_0 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^"|"$', '') COMMENT 'column_materializer::$group_0',$group_1 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^"|"$', '') COMMENT 'column_materializer::$group_1',@@ -2533,12 +2527,6 @@ CREATE TABLE posthog.flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,$group_0 String COMMENT 'column_materializer::$group_0',$group_1 String COMMENT 'column_materializer::$group_1',diff --git a/posthog/clickhouse/hcl/sql/local-multi/data.sql b/posthog/clickhouse/hcl/sql/local-multi/data.sqlindex 80ebb1236b43..258cee59455c 100644--- a/posthog/clickhouse/hcl/sql/local-multi/data.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/data.sql@@ -1223,12 +1223,6 @@ CREATE TABLE posthog.sharded_flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,$group_0 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^"|"$', '') COMMENT 'column_materializer::$group_0',$group_1 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^"|"$', '') COMMENT 'column_materializer::$group_1',@@ -3169,12 +3163,6 @@ CREATE TABLE posthog.flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,$group_0 String COMMENT 'column_materializer::$group_0',$group_1 String COMMENT 'column_materializer::$group_1',diff --git a/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sql b/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sqlindex 2a4f46655d5f..f44ecd66a69d 100644--- a/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sql@@ -42,12 +42,6 @@ CREATE TABLE posthog.kafka_flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC')) ENGINE = Kafka(warpstream_ingestion) SETTINGS kafka_format = 'JSONEachRow', kafka_group_name = 'clickhouse_flag_evaluations', kafka_skip_broken_messages = 100, kafka_topic_list = 'clickhouse_flag_evaluations';CREATE TABLE posthog.kafka_heatmaps (@@ -304,12 +298,6 @@ CREATE TABLE posthog.writable_flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,_timestamp DateTime,_offset UInt64,@@ -470,7 +458,7 @@ CREATE MATERIALIZED VIEW posthog.cohort_membership_mv TO posthog.writable_cohortFROM posthog.kafka_cohort_membership;CREATE MATERIALIZED VIEW posthog.distinct_id_usage_mv TO posthog.writable_distinct_id_usage (team_id Int64, distinct_id String, minute DateTime('UTC'), event_count UInt8) AS SELECT team_id, distinct_id, toStartOfMinute(timestamp) AS minute, 1 AS event_countFROM posthog.kafka_distinct_id_usage;-CREATE MATERIALIZED VIEW posthog.flag_evaluations_mv TO posthog.writable_flag_evaluations (uuid UUID, event LowCardinality(String), properties String, timestamp DateTime64(6, 'UTC'), team_id Int64, distinct_id String, created_at DateTime64(6, 'UTC'), person_id UUID, person_properties String, group0_properties String, group1_properties String, group2_properties String, group3_properties String, group4_properties String, inserted_at Nullable(DateTime64(6, 'UTC')), _timestamp Nullable(DateTime), _offset UInt64, _partition UInt64) AS SELECT+CREATE MATERIALIZED VIEW posthog.flag_evaluations_mv TO posthog.writable_flag_evaluations (uuid UUID, event LowCardinality(String), properties String, timestamp DateTime64(6, 'UTC'), team_id Int64, distinct_id String, created_at DateTime64(6, 'UTC'), person_id UUID, inserted_at Nullable(DateTime64(6, 'UTC')), _timestamp Nullable(DateTime), _offset UInt64, _partition UInt64) AS SELECTuuid,event,properties,@@ -479,12 +467,6 @@ CREATE MATERIALIZED VIEW posthog.flag_evaluations_mv TO posthog.writable_flag_evdistinct_id,created_at,person_id,- person_properties,- group0_properties,- group1_properties,- group2_properties,- group3_properties,- group4_properties,if(inserted_at = toDateTime64('1970-01-01 00:00:00', 6, 'UTC'), _timestamp, inserted_at) AS inserted_at,_timestamp,_offset,diff --git a/posthog/clickhouse/hcl/sql/local-single/all.sql b/posthog/clickhouse/hcl/sql/local-single/all.sqlindex 6782a7aa72e2..29732036a703 100644--- a/posthog/clickhouse/hcl/sql/local-single/all.sql+++ b/posthog/clickhouse/hcl/sql/local-single/all.sql@@ -473,12 +473,6 @@ CREATE TABLE posthog.kafka_flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC')) ENGINE = Kafka(warpstream_ingestion) SETTINGS kafka_format = 'JSONEachRow', kafka_group_name = 'clickhouse_flag_evaluations', kafka_skip_broken_messages = 100, kafka_topic_list = 'clickhouse_flag_evaluations';CREATE TABLE posthog.kafka_groups (@@ -2169,12 +2163,6 @@ CREATE TABLE posthog.sharded_flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,$group_0 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^"|"$', '') COMMENT 'column_materializer::$group_0',$group_1 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^"|"$', '') COMMENT 'column_materializer::$group_1',@@ -3748,12 +3736,6 @@ CREATE TABLE posthog.writable_flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,_timestamp DateTime,_offset UInt64,@@ -4554,7 +4536,7 @@ CREATE MATERIALIZED VIEW posthog.events_recent_json_mv TO posthog.writable_event_timestamp,_offsetFROM posthog.sharded_events;-CREATE MATERIALIZED VIEW posthog.flag_evaluations_mv TO posthog.writable_flag_evaluations (uuid UUID, event LowCardinality(String), properties String, timestamp DateTime64(6, 'UTC'), team_id Int64, distinct_id String, created_at DateTime64(6, 'UTC'), person_id UUID, person_properties String, group0_properties String, group1_properties String, group2_properties String, group3_properties String, group4_properties String, inserted_at Nullable(DateTime64(6, 'UTC')), _timestamp Nullable(DateTime), _offset UInt64, _partition UInt64) AS SELECT+CREATE MATERIALIZED VIEW posthog.flag_evaluations_mv TO posthog.writable_flag_evaluations (uuid UUID, event LowCardinality(String), properties String, timestamp DateTime64(6, 'UTC'), team_id Int64, distinct_id String, created_at DateTime64(6, 'UTC'), person_id UUID, inserted_at Nullable(DateTime64(6, 'UTC')), _timestamp Nullable(DateTime), _offset UInt64, _partition UInt64) AS SELECTuuid,event,properties,@@ -4563,12 +4545,6 @@ CREATE MATERIALIZED VIEW posthog.flag_evaluations_mv TO posthog.writable_flag_evdistinct_id,created_at,person_id,- person_properties,- group0_properties,- group1_properties,- group2_properties,- group3_properties,- group4_properties,if(inserted_at = toDateTime64('1970-01-01 00:00:00', 6, 'UTC'), _timestamp, inserted_at) AS inserted_at,_timestamp,_offset,@@ -6363,12 +6339,6 @@ CREATE TABLE posthog.flag_evaluations (distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp,$group_0 String COMMENT 'column_materializer::$group_0',$group_1 String COMMENT 'column_materializer::$group_1',diff --git a/posthog/clickhouse/test/__snapshots__/test_schema.ambr b/posthog/clickhouse/test/__snapshots__/test_schema.ambrindex 25b75707de4c..bd5bf478cff2 100644--- a/posthog/clickhouse/test/__snapshots__/test_schema.ambr+++ b/posthog/clickhouse/test/__snapshots__/test_schema.ambr@@ -324,12 +324,6 @@distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC'))ENGINE = Kafka(warpstream_ingestion, kafka_topic_list = 'clickhouse_flag_evaluations_test', kafka_group_name = 'clickhouse_flag_evaluations', kafka_format = 'JSONEachRow')@@ -1969,12 +1963,6 @@distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp, $group_0 String COMMENT 'column_materializer::$group_0'@@ -2011,12 +1999,6 @@distinct_id,created_at,person_id,- person_properties,- group0_properties,- group1_properties,- group2_properties,- group3_properties,- group4_properties,-- Fall back to the Kafka message timestamp, which is stable across replays-- (inserted_at checkpoints the sync_feature_flag_last_called task, and an-- epoch-stamped row would stay invisible to it forever).@@ -2629,12 +2611,6 @@distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC'))ENGINE = Kafka(warpstream_ingestion, kafka_topic_list = 'clickhouse_flag_evaluations_test', kafka_group_name = 'clickhouse_flag_evaluations', kafka_format = 'JSONEachRow')@@ -7352,12 +7328,6 @@distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp, $group_0 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^"|"$', '') COMMENT 'column_materializer::$group_0'@@ -9687,12 +9657,6 @@distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp@@ -12577,12 +12541,6 @@distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC') DEFAULT timestamp, $group_0 String DEFAULT replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^"|"$', '') COMMENT 'column_materializer::$group_0'diff --git a/posthog/dags/tests/test_data_deletion_requests.py b/posthog/dags/tests/test_data_deletion_requests.pyindex 6562a398f40b..9386151cb7f8 100644--- a/posthog/dags/tests/test_data_deletion_requests.py+++ b/posthog/dags/tests/test_data_deletion_requests.py@@ -102,15 +102,14 @@ def _truncate_writable_events(client: Client) -> None:client.execute("TRUNCATE TABLE IF EXISTS sharded_events")-def _insert_flag_evaluations_with_properties(rows: list[tuple], client: Client, column: str = "properties") -> None:- # Rows of (team_id, distinct_id, <column>_json, uuid, timestamp, inserted_at). The event name is+def _insert_flag_evaluations_with_properties(rows: list[tuple], client: Client) -> None:+ # Rows of (team_id, distinct_id, properties_json, uuid, timestamp, inserted_at). The event name is# stamped here because a property-removal request narrows on it. inserted_at is set explicitly# rather than left to its `DEFAULT timestamp` so a test can place a row before or after the- # removal marker, which is what the marker-bounded gate keys on. `column` selects which JSON blob- # column the row's properties land in: `properties` (event) or `person_properties`.+ # removal marker, which is what the marker-bounded gate keys on.client.execute(- f"INSERT INTO writable_flag_evaluations "- f"(team_id, distinct_id, {column}, uuid, timestamp, inserted_at, event) VALUES",+ "INSERT INTO writable_flag_evaluations "+ "(team_id, distinct_id, properties, uuid, timestamp, inserted_at, event) VALUES",[(*row, FLAG_EVALUATIONS_SOURCE_EVENT) for row in rows],)@@ -2205,34 +2204,24 @@ def test_get_property_removal_shards_refuses_when_flag_evaluations_holds_matchin@pytest.mark.django_db@pytest.mark.parametrize(- "properties, person_properties, insert_column, insert_value, expect_refusal",+ "properties, person_properties, insert_value, expect_refusal",[- pytest.param(- [], ["email"], "person_properties", '{"email": "[email protected]"}', False, id="person_properties_only"- ),- pytest.param(- ["$ip"],- ["email"],- "person_properties",- '{"email": "[email protected]"}',- False,- id="mixed_matches_person_property",- ),- pytest.param(["$ip"], ["email"], "properties", '{"$ip": "1.2.3.4"}', True, id="mixed_matches_event_property"),+ pytest.param([], ["email"], '{"email": "[email protected]"}', False, id="person_properties_only"),+ pytest.param(["$ip"], ["email"], '{"email": "[email protected]"}', False, id="mixed_row_holds_only_the_person_key"),+ pytest.param(["$ip"], ["email"], '{"$ip": "1.2.3.4"}', True, id="mixed_matches_event_property"),],)def test_get_property_removal_shards_narrows_person_properties_on_flag_evaluations(cluster: ClickhouseCluster,properties: list[str],person_properties: list[str],- insert_column: str,insert_value: str,expect_refusal: bool,) -> None:- # flag_evaluations' person_properties column no longer receives real data (#95693), so the gate- # drops the person_properties half of its check: a row matching only that half now survives,- # which is the accepted cost. The target itself is still checked, so a row matching the request's- # event property must still refuse.+ # flag_evaluations has no person_properties column (#95693), so the gate drops the+ # person_properties half of its check. A row that holds only the key named there survives, which+ # is the accepted cost, and a gate that kept that half would query a column the table does not+ # have. The event-property half still applies, so a row matching it must still refuse.request = DataDeletionRequest.objects.create(team_id=PROP_TEAM_ID,request_type=RequestType.PROPERTY_REMOVAL,@@ -2254,7 +2243,6 @@ def test_get_property_removal_shards_narrows_person_properties_on_flag_evaluatiopartial(_insert_flag_evaluations_with_properties,[(PROP_TEAM_ID, "someone", insert_value, str(uuid4()), before_marker, before_marker)],- column=insert_column,)).result()diff --git a/posthog/models/flag_evaluations/sql.py b/posthog/models/flag_evaluations/sql.pyindex 339f75497740..367d593c6673 100644--- a/posthog/models/flag_evaluations/sql.py+++ b/posthog/models/flag_evaluations/sql.py@@ -12,10 +12,11 @@ from posthog.kafka_client.topics import KAFKA_CLICKHOUSE_FLAG_EVALUATIONS# Flag evaluation telemetry ($feature_flag_called events routed out of the events# table). The column set is the events table's, narrowed to what a flag evaluation-# actually carries: no elements_chain, no person_mode, no *_created_at companions-# to the person and group properties. It keeps the full properties JSON as the-# source of truth, so queries and integrations built on event properties survive-# the routing switch. The 90-day TTL is what makes rows that wide affordable.+# actually carries: no elements_chain, no person_mode, and no person or group+# property blobs, since no Insight or Hog function breaks down or filters on them.+# It keeps the full properties JSON as the source of truth, so queries and+# integrations built on event properties survive the routing switch. The 90-day+# TTL is what makes rows that wide affordable.## Naming convention follows the sharded main-cluster table family (see heatmaps):# * `sharded_flag_evaluations` — sharded replicated MergeTree on DATA nodes.@@ -83,12 +84,6 @@ _FLAG_EVALUATIONS_COLUMNS_TEMPLATE = """distinct_id String,created_at DateTime64(6, 'UTC'),person_id UUID,- person_properties String,- group0_properties String,- group1_properties String,- group2_properties String,- group3_properties String,- group4_properties String,inserted_at DateTime64(6, 'UTC'){ts_default}""".strip()@@ -264,7 +259,6 @@ SETTINGS kafka_skip_broken_messages = 100""")-# The Kafka JSONEachRow parser fills missing fields with the type's zero value, so# a DateTime64 column reads as epoch when a producer omits it._EPOCH_DT64 = "toDateTime64('1970-01-01 00:00:00', 6, 'UTC')"@@ -282,12 +276,6 @@ AS SELECTdistinct_id,created_at,person_id,- person_properties,- group0_properties,- group1_properties,- group2_properties,- group3_properties,- group4_properties,-- Fall back to the Kafka message timestamp, which is stable across replays-- (inserted_at checkpoints the sync_feature_flag_last_called task, and an-- epoch-stamped row would stay invisible to it forever).