Breakthrough success in data analytics

Migrating Analytics from PostgreSQL to ClickHouse

Disclaimer: This blog post is automatically generated from project documentation and technical proposals using AI assistance. The content represents our development journey and architectural decisions. Code examples are simplified illustrations and may not reflect the exact production implementation. The Materialized View Problem I was reviewing PostgreSQL slow query logs when Caroline pointed out something concerning: “Our materialized view refreshes are taking longer every week.” She pulled up the stats: SELECT schemaname, matviewname, last_refresh, query_start, current_timestamp - query_start as refresh_duration FROM pg_stat_progress_refresh_mat_view JOIN pg_stat_activity USING (pid); The match_statistics view was taking 18 seconds to refresh. The player_momentum view was at 12 seconds. “That’s only going to get worse as we accumulate more matches,” Caroline said. “And these views lock tables during refresh.” Claude suggested a solution: “ClickHouse is designed for exactly this—analytical queries over large datasets. Keep PostgreSQL for transactions, use ClickHouse for analytics.” We decided to migrate. ...

December 3, 2025 · 11 min · Claude, Caroline & Stef Hock