Skip to content

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

ClickHouse 7 min read Case study mediumAdept

ClickPy at 2 Trillion rows: Scaling ingestion and fixing the past

ClickPy, ClickHouse's free PyPI download analytics service, now holds over 2.2 trillion rows, and its cron-based ingestion script was replaced with ClickPipes without downtime. The new pipeline loaded data into a staging database with cloned schemas, a Null-engine raw table and a materialized view that holds all transformation logic. A fresh GCS bucket avoided reprocessing history, and the new pipeline ran in parallel and was validated by comparing daily row counts before cutover. That validation exposed missing historical days, which were fixed with lightweight deletes and per-day re-ingestion. Daily-aggregated materialized views could be deleted and repopulated by date, while non-daily aggregates such as monthly totals had to be dropped, rebuilt and recreated to avoid double counting.

Related posts

  • ClickPy reaches one trillion rows

    ClickHouse mediumAdept

    ClickPy, a free open-source real-time analytics service for PyPI download statistics built on ClickHouse, has passed one trillion rows in its main downloads table. The data is exported from BigQuery to Parquet files in Google Cloud Storage, bulk-loaded via the s3 table function and kept current by an hourly cron-plus-worker pipeline (ClickLoad). Materialized views maintain pre-aggregated downstream tables for common query patterns, and dictionaries handle reference data. Public read-only access is limited to 10 billion rows read per query, so the aggregated tables, not the raw pypi table, are the practical way to query it.

  • How Spyne simplified their CDC pipeline with ClickPipes and ClickHouse Cloud

    ClickHouse mediumAdept

    Spyne replaced a self-managed Debezium → Kafka → ClickHouse Kafka-engine/materialized-view CDC pipeline with ClickPipes on ClickHouse Cloud. The move eliminated 1–1.5 hours of manual work per table onboarding and fixed schema drift, where new source columns were silently dropped by DDL-locked materialized views. It also brought tradeoffs: snapshotting a new table pauses the whole pipe, so critical tables were isolated into dedicated pipes. ReplacingMergeTree's eventual consistency required adding FINAL to queries at extra CPU cost, and binlog loss forces full table resyncs instead of targeted partial ones.

  • “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.

  • Data Hive: The story of beehiiv’s journey from Postgres to ClickHouse

    ClickHouse easyNovice

    beehiiv replaced its Postgres-and-Ruby-queue analytics system, which struggled with billions of email events and had multi-hour reporting delays, with a Kafka-fed ClickHouse Cloud pipeline. The design leans on ReplacingMergeTree for idempotent ingestion and event replay, dictionaries to enrich inserts without joins, ephemeral columns for intermediate calculations, materialized views as pre-aggregated shadow tables with alternate sort keys, and window functions for analytics. After six months the system held over 33 billion raw events in 1.5 TiB compressed (13 TiB uncompressed), with 22 ms median and 85 ms average query times. Creators now see send performance within seconds instead of hours.

  • ClickHouse and the MTA Data Challenge

    ClickHouse mediumAdept

    Loading and cleaning the ~95 million-row NYC MTA subway turnstile dataset (2014–2022) in ClickHouse, using schema inference over S3, a staging table, and an optimized schema with LowCardinality strings, a combined DateTime column, UInt32 counters, sorted line-name arrays and a (station, date_time) ordering key. Because entry/exit counters are cumulative odometer-style readings that reset, count down and overflow, window functions partitioned by turnstile (ca, unit, scp) compute per-period deltas and discard negative or implausible values above a per-hour threshold. The steps are reproducible with clickhouse-local, and the cleaned data is published in the ClickHouse SQL playground.

The quest for software engineering knowledge.

Look:
Layout: