Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/internal/clickhouse-deletion-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
36 changes: 0 additions & 36 deletions posthog/clickhouse/hcl/golden/dev/data.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
36 changes: 0 additions & 36 deletions posthog/clickhouse/hcl/golden/local-multi/data.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
60 changes: 0 additions & 60 deletions posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
}
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -1628,12 +1592,6 @@ SELECT
distinct_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,
Expand Down Expand Up @@ -1665,24 +1623,6 @@ SQL
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 = "Nullable(DateTime64(6, 'UTC'))"
}
Expand Down
96 changes: 0 additions & 96 deletions posthog/clickhouse/hcl/golden/local-single/all.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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')"
}
Expand Down Expand Up @@ -11433,24 +11397,6 @@ SQL
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"
Expand Down Expand Up @@ -16806,24 +16752,6 @@ SQL
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"
Expand Down Expand Up @@ -19911,12 +19839,6 @@ SELECT
distinct_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,
Expand Down Expand Up @@ -19948,24 +19870,6 @@ SQL
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 = "Nullable(DateTime64(6, 'UTC'))"
}
Expand Down
9 changes: 0 additions & 9 deletions posthog/clickhouse/hcl/roles/data/prod/tables.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}
18 changes: 0 additions & 18 deletions posthog/clickhouse/hcl/roles/data/shared/flag_evaluations.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading
Loading