OpenReplay is a self-hosted session replay and product analytics platform that helps developers reproduce bugs by showing them exactly what a user did. The team replaced Postgres with ClickHouse to handle billions of behavioral events per day, using a single TTL setting to end weekend-long manual retention cleanups and dropping session search times from up to 10 seconds to about one second. Materialized views in ClickHouse reduced the time to modify data pipeline transformations from two days to half a day by centralizing logic that once required separate Go workers. The largest customers run a single vertically scaled ClickHouse instance ingesting up to 6 TB daily, with sub-second queries enabled by a query cache. The database schema consists of two main tables, and native JSON support allows custom events to be inserted and queried as columns for funnels, heat maps, and flow charts.
Context
OpenReplay is a self-hosted session replay and product analytics platform that needed to handle billions of behavioral events and terabytes of data per day within each customer’s own environment. Initially built on Postgres, they faced performance bottlenecks and operational complexity with retention cleanup. They migrated to ClickHouse to achieve real-time ingestion, sub-second queries, and simplified maintenance.
Approach / What changed
OpenReplay replaced its Postgres-based event storage with a single vertically scaled ClickHouse instance for all behavioral events. They configured a TTL setting to automate data retention, implemented a chain of materialized views for data transformation, and leveraged ClickHouse’s native JSON support for custom events. They also enabled the query cache for faster repeat queries.
Takeaways
1
ClickHouse’s TTL feature eliminated manual weekend-long retention cleanups that required locking tables and coordinating with customers, reducing operational overhead significantly.
2
Materialized views in ClickHouse reduced the time to change data pipeline transformations from two days to half a day by centralizing logic that previously required separate Go workers.
3
OpenReplay runs a single vertically scaled ClickHouse instance for its largest customers, ingesting up to 6 TB per day with sub-second queries, made faster by enabling the query cache.
FAQ
Why did OpenReplay replace Postgres with ClickHouse?
Postgres could not handle behavioral analytics queries quickly; session search took up to 10 seconds after tuning, and retention cleanup required locking tables and weekend coordination. ClickHouse reduced query times to about one second and automated retention via TTL.
How does OpenReplay handle custom user-defined events?
ClickHouse's native JSON support allows custom events to be inserted into the same table and queried as columns, enabling features like funnels and heat maps without requiring schema modifications.
What scale does OpenReplay achieve with ClickHouse?
The largest customers ingest billions of events and up to 6 TB per day on a single vertically scaled ClickHouse instance, with sub-second query responses aided by a query cache.
Audience Intelligence turns scattered social and behavioral signals into decisions about who to reach and when. This architecture map shows the four layers, what each owns, and where the trade-offs land.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.