Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 5 min read Case study mediumAdept

How Klaviyo uses a 192-node ClickHouse cluster for real-time segmentation and personalization

Klaviyo replaced a Python-orchestrated segmentation engine built on MySQL and a large Cassandra cluster of pre-aggregated counters with a 192-node on-prem ClickHouse cluster. The cluster is sharded first by company ID and then by profile ID, and computes segment membership with a single query in about one second instead of over an hour. Time-based conditions appear in roughly 60% of segments and used to be reprocessed on a schedule. To avoid that wasted work, the team built an entity-attribute-value table via a materialized view with the property name in the sort key, so conditions can be pushed down at read time. Updates now run in two phases: a lightweight query finds affected profile-segment pairs, which are chunked onto a message queue for parallel workers that can scale independently.

Assumes: columnar databasesmaterialized viewssharding basics

Related posts

  • Appcues delivers personalized customer engagement with ClickHouse Cloud

    ClickHouse mediumAdept

    Appcues moved its customer-facing product analytics and segmentation from Snowflake plus Airflow rollups to ClickHouse Cloud, covering 1.31 PB of data and over 1 billion user profiles. Events flow through Kafka into a deduplicating consumer. Materialized views replaced the Airflow pre-aggregation jobs, and SharedReplacingMergeTree with argMax instead of FINAL resolves the latest profile state. Lightweight deletes in ClickHouse 25.6 cleared a GDPR deletion backlog. P95 query latency fell from 20+ seconds to under 2, ingestion-to-query latency dropped from 10+ minutes to about 5 seconds, and analytics spend fell 23%.

  • Building a Unified Data Platform with ClickHouse

    ClickHouse mediumAdept

    Synq, a data observability startup, consolidated its user-facing application, internal BI, in-app analytics and ML training data onto a single ClickHouse Cloud cluster after Postgres with a time-series plugin struggled with large backfills. Naive per-message inserts from its Go ingestion service caused part explosions and insert timeouts. Buffer tables fixed that but used too much cluster memory, so the team settled on Async Inserts and handled duplicates with ReplacingMergeTree plus LIMIT 1 BY on a surrogate key. Materialized views feeding query-specific tables with ORDER BY keys matched to access patterns cut scanned data by an order of magnitude and keep API latencies around 100ms, while dbt builds auditing and daily-aggregated analytics tables without separate ETL.

  • How ClickHouse Cloud enabled LaunchDarkly to build and ship features faster

    ClickHouse mediumAdept

    LaunchDarkly replaced Kinesis/Flink/Lambda streaming pipelines and an S3/Parquet/Athena batch warehouse with ClickHouse Cloud. Raw events are now queried directly, and materialized views are added only where needed. The system ingests about 6 PB/month of uncompressed JSON through an HTTP API, S3 protobuf batches, Lambda-converted Parquet and INSERT INTO SELECT. Data is fresh in about 30 seconds with roughly 100 days of retention, high-cardinality per-user analytics became practical, and seven product features now run on it. Lessons learned: don't coarsen ORDER BY keys, drop OLTP habits (for example, use two-stage queries for latest-N), and plan for workload isolation as adoption outpaces the platform team. Next steps are ingest-time joins for Release Guardian regression detection and migrating Elasticsearch workloads.

  • How FabFunnel powers real-time marketing analytics with ClickHouse Cloud

    ClickHouse mediumAdept

    FabFunnel moved its marketing analytics off a normalized MySQL reporting stack, where month-long queries took 11 seconds and year-long reports crashed browsers due to client-side merges, to ClickHouse Cloud. Spend and revenue data now stream through Confluent Kafka via ClickPipes into ReplacingMergeTree tables, which replace the old delete-and-reinsert refresh cycle. Refreshable materialized views pre-aggregate into a single reporting table, and a buffer table handles real-time click data. Queries now return in under a second, and the system handled 19.2M queries reading 11.67 trillion rows in one month.

  • Ongage's Strategic Shift to ClickHouse for Real-time Email Marketing

    ClickHouse easyNovice

    Ongage, an email and SMS marketing automation company processing about half a billion messages a day, moved its campaign analytics and automation reporting from a large AWS RDS MySQL cluster (alongside MongoDB and Redshift) to ClickHouse Cloud. The pipeline loads raw events from S3 with the s3Cluster function and copies around eight MySQL tables in via the MySQL table engine, swapping them in with EXCHANGE. A materialized view enriches inserted events with joins and writes them to a SummingMergeTree table that serves queries. Reports that took two to three hours on MySQL now return almost instantly. ClickHouse was chosen over SingleStore on storage cost (SingleStore was 6x more expensive) and materialized view support, and the managed cloud offering won on operational burden and support.

The quest for software engineering knowledge.

Look:
Layout: