---
title: "Harnessing the Power of Materialized Views and ClickHouse for High-Performance Analytics at Inigo"
description: "Inigo stores analytics on billions of GraphQL API requests in ClickHouse after rejecting Snowflake as too slow and costly for customer-facing data and lacking a local emulator, and PostgreSQL because its indexes and costs blew up past roughly 100K–1M rows."
url: "https://swe.quest/articles/harnessing-the-power-of-materialized-views-and-clickhouse-for-high-performance-ebcfa2d951da7c43"
canonical: "https://clickhouse.com/blog/harnessing-the-power-of-materialized-views-and-clickhouse-for-high-performance-analytics-at-inigo"
source: "ClickHouse"
published: "2023-06-23"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["analytics","databases","sql","performance"]
---

# Harnessing the Power of Materialized Views and ClickHouse for High-Performance Analytics at Inigo

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-06-23, 8 min read, Case study. Original: [https://clickhouse.com/blog/harnessing-the-power-of-materialized-views-and-clickhouse-for-high-performance-analytics-at-inigo](https://clickhouse.com/blog/harnessing-the-power-of-materialized-views-and-clickhouse-for-high-performance-analytics-at-inigo)

## Summary

Inigo stores analytics on billions of GraphQL API requests in ClickHouse after rejecting Snowflake as too slow and costly for customer-facing data and lacking a local emulator, and PostgreSQL because its indexes and costs blew up past roughly 100K–1M rows. Raw tables keyed on observed\_at feed AggregatingMergeTree materialized views bucketed at 1-minute, 6-minute, 40-minute and 3-hour intervals, so most queries scan thousands of aggregated rows instead of millions of raw ones. Counts are stored as a calls column and read back with sum(calls), percentiles use quantilesState in the view and quantileMerge at query time, and high-cardinality fields like trace\_id stay in raw tables only. The result is month-long retention in views versus a week of raw data, lower database load, and fast local integration tests, at the cost of setup complexity and no transactions.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- SQL GROUP BY aggregation ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- columnar databases ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

ClickHouse, Materialized Views, AggregatingMergeTree, Snowflake, PostgreSQL, GraphQL, Inigo

## Related posts

- [Better Analytics at Scale with Trackingplan and ClickHouse](https://swe.quest/articles/better-analytics-at-scale-with-trackingplan-and-clickhouse-fe79c2efef76743f.md): ClickHouse · 2024-01-24 · Medium · 6 min read · Analytics & OLAP, Databases, Multi-tenancy, Cloud platforms
  Trackingplan, which tests web, mobile and backend analytics by sampling events sent to tools like Google Analytics and Segment, moved from DynamoDB with PySpark-precomputed statistics to ClickHouse Cloud so it could answer unforeseen ad hoc queries on raw data.
- [Using Materialized Views in ClickHouse](https://swe.quest/articles/using-materialized-views-in-clickhouse-f547ca7b5675b5e9.md): ClickHouse · 2023-01-19 · Medium · 13 min read · Analytics & OLAP, SQL, Performance engineering, Data pipelines
  ClickHouse materialized views act as insert-time triggers that write the result of a SELECT into a target table, letting expensive aggregations be precomputed.
- [Accelerating ClickHouse queries on JSON data for faster Bluesky insights](https://swe.quest/articles/accelerating-clickhouse-queries-on-json-data-for-faster-bluesky-insights-cce6ed7a467f6449.md): ClickHouse · 2025-03-19 · Medium · 29 min read · Analytics & OLAP, Performance engineering, SQL, Databases
  Incremental materialized views feeding AggregatingMergeTree tables cut ClickHouse dashboard queries over 4+ billion Bluesky JSON documents (1.6 TiB) from 44–56 seconds to 3–7 ms. Partial aggregation states are computed only for newly inserted rows and merged in the background, so the pre-aggregated tables stay tiny (e.g. 892 rows, 11 KiB) and constant-size regardless of source growth.
- [Ongage's Strategic Shift to ClickHouse for Real-time Email Marketing](https://swe.quest/articles/ongage-s-strategic-shift-to-clickhouse-for-real-time-email-marketing-dfca8e1a38de318e.md): ClickHouse · 2023-08-24 · Easy · 7 min read · Analytics & OLAP, MySQL, Databases, Cloud platforms
  Ongage, an email and SMS marketing automation company processing about half a billion messages a day, moved its campaign analytics and automation reporting from a large AWS RDS MySQL cluster (alongside MongoDB and Redshift) to ClickHouse Cloud.
- [Why ClickHouse Cloud wins at real-time analytics](https://swe.quest/articles/why-clickhouse-cloud-wins-at-real-time-analytics-ff3bf2806ccb7be7.md): ClickHouse · 2026-10-28 · Medium · 21 min read · Analytics & OLAP, Storage engines, Query engines, Performance engineering, Cost optimization
  In the CostBench streaming benchmark (113.2 billion stock quotes ingested at about 1M rows/s while queries ran), ClickHouse Cloud scored 412× to 1,996× better end-to-end performance per dollar than Snowflake, Databricks, BigQuery and Redshift Serverless.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
