---
title: "How Klaviyo uses a 192-node ClickHouse cluster for real-time segmentation and personalization"
description: "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."
url: "https://swe.quest/articles/how-klaviyo-uses-a-192-node-clickhouse-cluster-for-real-time-segmentation-and-ba32bd092d16f47c"
canonical: "https://clickhouse.com/blog/how-klaviyo-uses-a-192-node-clickhouse-cluster-for-real-time-segmentation-and-personalization"
source: "ClickHouse"
published: "2025-08-05"
difficulty: "medium"
kind: "Case study"
reading_minutes: 5
tags: ["analytics","scalability","system-design","distributed-databases"]
---

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

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2025-08-05, 5 min read, Case study. Original: [https://clickhouse.com/blog/how-klaviyo-uses-a-192-node-clickhouse-cluster-for-real-time-segmentation-and-personalization](https://clickhouse.com/blog/how-klaviyo-uses-a-192-node-clickhouse-cluster-for-real-time-segmentation-and-personalization)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)
- [Distributed databases](https://swe.quest/tags/distributed-databases.md) (Data & databases)

## Prerequisites

- columnar databases ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- materialized views
- sharding basics ([easy posts on Distributed databases](https://swe.quest/tags/distributed-databases.md?difficulty=easy))

## Keywords

ClickHouse, Klaviyo, Cassandra, MySQL, ClickPipes, Model Context Protocol

## Related posts

- [Appcues delivers personalized customer engagement with ClickHouse Cloud](https://swe.quest/articles/appcues-delivers-personalized-customer-engagement-with-clickhouse-cloud-70117f941c9e140c.md): ClickHouse · 2026-06-18 · Medium · 8 min read · Analytics & OLAP, Databases, Performance engineering, Cost optimization
  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.
- [Building a Unified Data Platform with ClickHouse](https://swe.quest/articles/building-a-unified-data-platform-with-clickhouse-cc8bf54cebee136c.md): ClickHouse · 2023-07-28 · Medium · 10 min read · Analytics & OLAP, Databases, Data pipelines, Performance engineering, Go
  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.
- [How ClickHouse Cloud enabled LaunchDarkly to build and ship features faster](https://swe.quest/articles/how-clickhouse-cloud-enabled-launchdarkly-to-build-and-ship-features-faster-0e4ac03aed14f7e6.md): ClickHouse · 2026-01-22 · Medium · 10 min read · Analytics & OLAP, Data pipelines, Observability, Multi-tenancy, Cloud platforms
  LaunchDarkly replaced Kinesis/Flink/Lambda streaming pipelines and an S3/Parquet/Athena batch warehouse with ClickHouse Cloud.
- [How FabFunnel powers real-time marketing analytics with ClickHouse Cloud](https://swe.quest/articles/how-fabfunnel-powers-real-time-marketing-analytics-with-clickhouse-cloud-693f5ffb0f0b9887.md): ClickHouse · 2025-11-20 · Medium · 5 min read · Analytics & OLAP, Data pipelines, MySQL, Ads, Performance engineering
  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.
- [Ongage's Strategic Shift to ClickHouse for Real-time Email Marketing](https://swe.quest/articles/ongage-s-strategic-shift-to-clickhouse-for-real-time-email-marketing-dfca8e1a38de318e.md): ClickHouse · 2023-08-24 · Easy · 7 min read · Analytics & OLAP, MySQL, Databases, Cloud platforms
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
