Catalogue / posthog-2021-clickhouse-migration

PostHog moved its event analytics from Heroku Postgres to ClickHouse, switching queries over one at a time behind feature flags

PostHog, 2021. Event storage and analytics queries.

Organisation
PostHog
Evidence
Reported from production
Source
How we turned ClickHouse into our event mansion

PostHog blog, published 2021-11-06

Records

Decision#d1

Move event analytics from Postgres to ClickHouse for a product that customers also self-host

Failure#f1

Running several hundred ClickHouse mutations a minute left merges behind and ended in an outage

Decision#d2

Ingest into both databases, then move analytic queries one by one behind the product's own feature flags

Sign in to read what was chosen, what was rejected and what it cost, each with its place in the source. An account is free. The job-queue cards are open without one.