How GitLab serves sub-second analytics to 50 million users
GitLab moved its user-facing product analytics from Postgres to ClickHouse after dashboards repeatedly hit its 15-second performance ceiling. Hierarchical multi-join queries over 100M+ rows dropped from 30–40 seconds to 0.24 seconds, and ClickHouse is now the default OLAP engine across GitLab.com, Dedicated and self-managed deployments. A hybrid data access layer routes queries between Postgres and ClickHouse, ingestion runs as TSV over HTTP plus an in-house CDC framework (Siphon), and materialized views are the main optimization tool. The team built and ran its own ClickHouse operator on object storage before moving SaaS to ClickHouse Cloud, and warns against self-managing unless required. It also flags poor visibility into background mutations as an ongoing operational pain.
Related posts
- London Meetup Report: Scaling Analytics with PostHog and Introducing HouseWatch
ClickHouse mediumAdept
PostHog scaled its product analytics platform by moving from Postgres to ClickHouse, with an events table holding roughly 62 TB uncompressed for a single column. Two optimizations drove most of the gains: materializing frequently queried JSON properties into columns, and a person overrides table that records merged user IDs with versions, is joined at query time, and is periodically rolled back into the events. Together these cut Y Combinator's average query time from 18s to 1s and P95 from 60s to 4s, and a user-facing sampling control lets users trade accuracy for speed. PostHog also introduced HouseWatch, an open-source React app deployed via Docker for monitoring long-running ClickHouse queries, analyzing table and column disk usage, killing queries, and managing migrations.
- “Just OLAP it”: How Ramp rebuilt its analytics platform on ClickHouse Cloud
ClickHouse mediumAdept
Ramp moved customer-facing spend analytics off its Postgres monolith after enterprise customers' reports on a single card-transactions table began taking 40+ seconds, and now serves them in milliseconds from ClickHouse Cloud. The pipeline streams Postgres CDC via Debezium into per-table Kafka topics. Stateless Python enrichers denormalize the records, and a connector loads them into ReplacingMergeTree tables, with recurring OPTIMIZE and FINAL queries handling deduplication. A local benchmark of 60M transactions partitioned by business ID ran 16,000 randomized queries in 12 seconds, and a four-engineer pod shipped to production in about two months. The platform now backs in-app Reporting and Budgets, and Ramp plans to add enriched tables for every core data type.
- 98% faster queries, 50% lower cloud costs: Verihubs’ journey from Postgres to ClickHouse
ClickHouse mediumAdept
Verihubs replaced a Postgres warehouse fed by daily Airflow batch pulls with a ClickHouse-based real-time OLAP stack. Kafka Connect and Debezium CDC stream data into MergeTree tables for append-only logs and ReplacingMergeTree tables for updatable rows. Materialized views and projections build daily and monthly rollups for reconciliation and invoicing, and Dagster handles complex detection jobs. Queries dropped from 20-30 minutes to 2-3 seconds, and cloud costs fell up to 50%. Lessons include designing ordering keys up front, choosing MergeTree engines carefully, expecting asynchronous mutations, and planning backfills because materialized views don't backfill automatically.
- Lago - Using ClickHouse to Scale an Events Engine
ClickHouse mediumAdept
Lago, an open-source usage-based billing platform ingesting millions of events per minute, moved its streamed billable events from Postgres to ClickHouse Cloud and kept Postgres for all other transactional data. The ClickHouse side is small: a Kafka-engine queue table, a materialized view that maps event metadata from JSON into a string array, and a MergeTree raw_events table keyed on organization, subscription, code and timestamp. Aggregation queries got 18x to 137x faster; for example, a weighted sum dropped from 6.6s to 48ms. The post also covers OLTP vs OLAP tradeoffs, columnar storage, insert-time materialized views and vectorized execution.
- How Polymarket scaled their data stack with Postgres and ClickHouse
ClickHouse mediumAdept
Polymarket moved analytical workloads off its production PostgreSQL cluster and onto ClickHouse after internal Hex dashboards started timing out and scheduled leaderboard aggregations competed with transactional trading traffic. The new warehouse combines three sources: on-chain trades streamed in through Goldsky's ClickHouse sink, S3 clickstream files ingested with ClickPipes, and off-chain metadata pulled on a schedule from Postgres via the PostgreSQL table engine into MergeTree tables. Leaderboards are now built with refreshable materialized views and served by a Go API through parameterized views, which enabled per-category and per-time-period leaderboards. The leaderboard migration took about two weeks and serves hundreds of requests per second at roughly 25 ms average latency.