Skip to content

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

ClickHouse 22 min read Case study hardMaster

How we made ClickStack 5x faster for ClickHouse observability

ClickStack's OpenTelemetry logs schema, inherited from the ClickHouse exporter for the OTel Collector, was reworked through a benchmark-driven process. The changes combined time-bucketed primary key redesign, text indexes, query rewrites, materialized views and newer ClickHouse features, cutting representative observability query latency by more than 5×. Every schema iteration was validated with the ClickCannon tool and ephemeral ClickHouse Cloud instances at 640 MiB/s ingest on three 24-core replicas. Each change was judged against ingestion throughput, CPU, memory, part counts and the full query workload, so a gain on one query pattern could not hide regressions elsewhere.

Assumes: ClickHouse MergeTree tablessparse primary indexesdata-skipping indexesOpenTelemetry logs

Related posts

  • How ClickStack makes ClickHouse faster for observability

    ClickHouse mediumAdept

    ClickStack speeds up ClickHouse for observability by generating and rewriting queries to fit how the engine stores, prunes and processes data, instead of passing raw SQL through. Search pages backwards through progressively wider time windows using optimize_read_in_order, and charts split the time range into bucket-aligned chunks that run in parallel. Filters on map attributes are redirected to materialized columns, and full-text searches are rewritten to index-aware functions such as hasAllTokens, which cut one example from 0.7s to 0.03s. Queries are also routed automatically to incremental materialized views chosen by an EXPLAIN ESTIMATE cost model, giving roughly 30x faster dashboards with 28x less memory.

  • What's new in ClickStack - April 2026

    ClickHouse mediumAdept

    ClickStack's April 2026 release adds alerts driven by arbitrary ClickHouse SQL, so rolling baselines and standard-deviation anomaly checks can be written with window functions and fire when the query returns 1. The default otel_logs schema was redesigned around ClickHouse full-text indexes on attribute map keys/values and lower(Body), with a five-minute bucketed ordering key, improving sample query performance by over 70% at comparable insert cost; versions before 26.2 fall back to bloom_filter indexes. An opt-in companion column flattens attribute maps into key=value arrays so map lookups are rewritten to indexed has() predicates, running 1.4–10x faster. Autocomplete now reads from 15-minute materialized-view rollups instead of scanning live tables, and heatmaps become a general chart type.

  • So, is ClickHouse winning the observability wars?

    ClickHouse mediumAdept

    ClickHouse has become a common storage and query layer for observability, and the main reason is its columnar architecture. Data sorted by an ordering key compresses well (users report 10–50x), queries read only the columns they need, sparse primary and skip indexes prune granules, and execution is vectorized and SIMD-friendly and runs in parallel across shards. The newer inverted-index full-text search cut multi-term log searches in one customer report from 30–45s to about 400ms. High-cardinality fields cost little in a columnar store compared with Prometheus's per-series model, though grouping by millions of values still costs memory. The engine is only the foundation; collection, schema, correlation and workflows still have to be built, which is where ClickStack comes in.

  • Why OpenAI chose ClickHouse for petabyte-scale observability

    ClickHouse mediumAdept

    OpenAI ingests petabytes of logs daily, growing over 20% monthly, into a ClickHouse cluster of 90 shards with two replicas each, fed by Fluent Bit agents. Recent data stays on local disk because about 80% of queries touch the last two days, and older logs tier to blob storage. ClickHouse was chosen for being open source, horizontally scalable, tunable in its indexing and queryable in SQL. When the GPT-4o image generation launch raised log volume 50% overnight, the team added a query-only replica and sampled logs, then profiled ClickHouse and found more than half of CPU time going to Bloom filter construction. Replacing a per-insert division with a multiply and bit shift cut CPU usage 40%, and the fix was upstreamed.

  • ClickHouse and OpenTelemetry

    ClickHouse mediumAdept

    ClickHouse now officially supports the OpenTelemetry Collector exporter for ClickHouse, which has reached beta for logs and traces. The exporter ships a "one size fits most" default schema. For production, ClickHouse recommends disabling automatic table creation, because concurrent exporters race to create tables, and defining your own tables or materialized views keyed to your query patterns. The LogHouse schema behind ClickHouse's 43 PB internal logging platform serves as the worked example. It orders by (PodName, Timestamp), uses LowCardinality for string columns under about 10k distinct values, applies ZSTD(1) because data lives on S3, and puts Bloom-filter indexes on map keys and values, which are not yet tuned.

The quest for software engineering knowledge.

Look:
Layout: