: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(clickhouse): match events_recent ttl to production at 9 days (#91030)
Tommy Gilmorec6fa15e859a8
diff --git a/posthog/clickhouse/test/__snapshots__/test_schema.ambr b/posthog/clickhouse/test/__snapshots__/test_schema.ambrindex 467d31a0f885..76d3e764077a 100644--- a/posthog/clickhouse/test/__snapshots__/test_schema.ambr+++ b/posthog/clickhouse/test/__snapshots__/test_schema.ambr@@ -7004,7 +7004,7 @@) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_{shard}/posthog.sharded_events_recent', '{replica}', _timestamp)PARTITION BY toStartOfDay(inserted_at)ORDER BY (team_id, toStartOfHour(inserted_at), event, cityHash64(distinct_id), cityHash64(uuid))- TTL toDateTime(inserted_at) + INTERVAL 7 DAY+ TTL toDate(inserted_at) + INTERVAL 9 DAYSETTINGS ttl_only_drop_parts = 1@@ -12038,7 +12038,7 @@) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_{shard}/posthog.sharded_events_recent', '{replica}', _timestamp)PARTITION BY toStartOfDay(inserted_at)ORDER BY (team_id, toStartOfHour(inserted_at), event, cityHash64(distinct_id), cityHash64(uuid))- TTL toDateTime(inserted_at) + INTERVAL 7 DAY+ TTL toDate(inserted_at) + INTERVAL 9 DAYSETTINGS storage_policy = 'hot_to_cold'SETTINGS ttl_only_drop_parts = 1diff --git a/posthog/models/event/sql.py b/posthog/models/event/sql.pyindex 33b6dcbe2c7d..b2e8e8fd8818 100644--- a/posthog/models/event/sql.py+++ b/posthog/models/event/sql.py@@ -670,7 +670,7 @@ def SHARDED_EVENTS_RECENT_TABLE_SQL():EVENTS_TABLE_BASE_SQL+ """PARTITION BY toStartOfDay(inserted_at)ORDER BY (team_id, toStartOfHour(inserted_at), event, cityHash64(distinct_id), cityHash64(uuid))-TTL toDateTime(inserted_at) + INTERVAL 7 DAY+TTL toDate(inserted_at) + INTERVAL 9 DAY{storage_policy}SETTINGS ttl_only_drop_parts = 1"""