Skip to content

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

ClickHouse 7 min read Case study mediumAdept

What Replo learned optimizing 100+ billion events in ClickHouse

Replo's in-product analytics for Shopify merchants ingests 3,000-5,000 events per second into ClickHouse and analyzes 100+ billion events, but reaching that point took several data-model resets. A precomputation pipeline that marked sessions with SummingMergeTree and recomputed them via a refreshable materialized view worked until fractional attribution exposed that MergeTree deduplication is only eventual. Adding FINAL/DISTINCT fixed correctness but made recomputation slower than the one-minute refresh window, causing a runaway backlog. The fix was to recompute only from a small table holding the last 40 minutes of purchase-related events, using joins in a single materialized view, and to handle historical backfills with offline scripts. Follow-up tuning included LowCardinality columns, materialized JSON fields and dropping Nullable types.

Related posts

  • Building a product analytics solution with ClickHouse

    ClickHouse mediumAdept

    ClickHouse's in-house product analytics platform, Galaxy, stores over 20 billion events (14 TB, roughly 14x compression) in a single denormalized MergeTree table keyed on created_at. A single sparse table avoids join overhead, since ClickHouse's sparse serialization makes empty columns cheap. Columns used for cohorts and filters should be top-level rather than buried in a JSON payload. Incremental materialized views speed up the few dozen recurring queries, and a custom SDK handles event capture.

  • “A generational leap”: How Trio unified payment analytics and cut storage by 88% with ClickHouse Cloud

    ClickHouse mediumAdept

    Trio, a Brazilian payments fintech processing 243M+ payments in H1 2025 and over 1B events a day, consolidated legacy and active systems into ClickHouse Cloud as a single analytical source of truth for reconciliation, compliance and dashboards. Events arrive via Redpanda into a custom ETL service (chosen over ClickPipes for control over schema drift) and via Airflow batch loads. Late, duplicate and out-of-order payment events are handled with a sliding window: refreshable materialized views recompute only a recent range (e.g. the last four hours every five minutes), ReplacingMergeTree deduplicates replays, and careful partitioning avoids global merges. Storage dropped about 88%, and a 5-billion-row migration went smoothly with minimal tuning.

  • Front-end observability at scale: How OpenReplay captures billions of daily events in real time with ClickHouse

    ClickHouse easyNovice

    OpenReplay, a self-hosted session replay and product analytics platform, moved behavioral event storage from Postgres to ClickHouse. Session search dropped from roughly 3–10 seconds to about one second, and ~1 TB event tables compressed to 1–2 GB. ClickHouse's TTL replaced weekend-long delete-and-vacuum retention jobs. A chain of materialized views off a single flat events table cut pipeline changes from two days to half a day, and native JSON makes custom event properties queryable as columns. Each customer deployment runs on a single vertically scaled ClickHouse instance, ingesting up to billions of events and ~6 TB per day, because avoiding sharding keeps self-hosted operations lean.

  • How Mercado Libre rebuilt its observability platform on ClickHouse Cloud with 75x faster trace queries

    ClickHouse mediumAdept

    Mercado Libre moved the storage layer of its OpenTelemetry-based tracing platform, O11y events, to ClickHouse Cloud. Transformation, filtering and aggregation now run inside the database through materialized views instead of on clients at query time. A ReplacingMergeTree lookup table ordered by attribute key, time buckets, value and trace ID, with a Bloom filter skip index, supports two-step high-cardinality queries against an AggregatingMergeTree trace summary. Queries dropped from over five minutes to about four seconds (75x), compression reached 86–89% on trillions of rows, and throughput is 400M spans/min with only 30% of critical apps migrated. Lessons include benchmarking under real load, iterating on primary keys, tuning batch and async inserts, and separating read, write and merge clusters.

  • How HighLevel rebuilt its data platform for speed, scale, and simplicity on ClickHouse Cloud

    ClickHouse mediumAdept

    HighLevel replaced MySQL, Elasticsearch, Firestore and a document database with ClickHouse Cloud for lead activity, workflow logs, notifications and billing dashboards. Results: an 11 TB MySQL table compressed to 1.3 TB, P99 latency fell from over 6 s to under 200 ms, and a 60 TB Elasticsearch log store shrank to 6.27 TB served by three replicas. Notifications were modeled as MergeTree raw events plus ReplacingMergeTree read/delete state, with argMax instead of FINAL, Bloom filters and two-month partitions. Dashboards moved from daily cron reprocessing to SummingMergeTree materialized views. Key lessons are to model data as immutable, iterate on schemas, use bulk inserts, and instrument the client with per-service query observability.

The quest for software engineering knowledge.

Look:
Layout: