---
title: "Trace similarity systems on top of ClickHouse to analyze crash stack traces from our CI"
description: "ClickHouse built a crash-deduplication pipeline for its CI that groups similar stack traces from fuzzing, stress and functional tests using the TraceSim similarity method, implemented almost entirely in ClickHouse SQL."
url: "https://swe.quest/articles/trace-similarity-systems-on-top-of-clickhouse-to-analyze-crash-stack-traces-c60df248c0d43431"
canonical: "https://clickhouse.com/blog/trace-similarity-stack-traces"
source: "ClickHouse"
published: "2025-09-24"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["debugging","ci-cd","sql","algorithms","testing"]
---

# Trace similarity systems on top of ClickHouse to analyze crash stack traces from our CI

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2025-09-24, 9 min read, Case study. Original: [https://clickhouse.com/blog/trace-similarity-stack-traces](https://clickhouse.com/blog/trace-similarity-stack-traces)

## Summary

ClickHouse built a crash-deduplication pipeline for its CI that groups similar stack traces from fuzzing, stress and functional tests using the TraceSim similarity method, implemented almost entirely in ClickHouse SQL. Crash logs are pulled from a CI logs cluster into a separate analysis cluster every 30 minutes via a refreshable materialized view. SQL UDFs strip addresses, file/line info, ABI tags and LLVM suffixes from frames on the fly so cleaning logic can change without reprocessing. Identical cleaned traces are hashed and matched against known GitHub issues, insignificant traces are filtered by PR count and master presence, and the rest are compared with weighted arraySimilarity to open or update issues.

Written by swe.quest, not by the author.

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

## Topics

- [Debugging](https://swe.quest/tags/debugging.md) (Engineering practices)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)

## Prerequisites

- SQL ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- ClickHouse MergeTree tables ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- stack traces

## Keywords

ClickHouse, TraceSim, arraySimilarity, ReplacingMergeTree, refreshable materialized view, sipHash64, GitHub Issues

## Related posts

- [Using Event Patterns in ClickStack to accelerate observability analysis](https://swe.quest/articles/using-event-patterns-in-clickstack-to-accelerate-observability-analysis-7a0fbc615de3ddd6.md): ClickHouse · 2025-11-26 · Medium · 9 min read · Observability, Analytics & OLAP, Algorithms
  ClickStack clusters logs and traces into event patterns at query time using the Drain3 template-mining algorithm, which runs in the browser via Pyodide (Python compiled to WebAssembly).
- [Seeing the Big Picture: Shopee’s Journey to Distributed Tracing with ClickHouse](https://swe.quest/articles/seeing-the-big-picture-shopee-s-journey-to-distributed-tracing-with-clickhouse-3d442ea100c6757c.md): ClickHouse · 2024-06-17 · Easy · 7 min read · Observability, Analytics & OLAP, Kubernetes, Debugging
  Shopee runs dozens of ClickHouse clusters on Kubernetes, fronted by managed services (Manager, Gateway, Console, Monitoring), and uses them to store and query distributed traces of the ClickHouse service itself.
- [How Canva achieved 10x faster search and 70% lower costs with ClickHouse](https://swe.quest/articles/how-canva-achieved-10x-faster-search-and-70-lower-costs-with-clickhouse-40e415ef239059a0.md): ClickHouse · 2025-12-01 · Medium · 7 min read · Observability, Analytics & OLAP, Cost optimization, Performance engineering, Databases
  Canva moved tracing and logging (about 3 million spans and 3 million logs per second) onto a self-managed ClickHouse cluster of 5 shards × 3 replicas on Kubernetes.
- [Testing the Performance of ClickHouse](https://swe.quest/articles/testing-the-performance-of-clickhouse-9f67306f19e976df.md): ClickHouse · 2021-08-19 · Medium · 11 min read · Performance engineering, Testing, CI/CD, Analytics & OLAP
  ClickHouse catches performance regressions in CI by running the reference and patched servers side by side on the same machine and alternating about 3000 end-to-end test queries between them.
- [What's new in ClickStack - April 2026](https://swe.quest/articles/what-s-new-in-clickstack-april-2026-8ecf13fb74019726.md): ClickHouse · 2026-05-19 · Medium · 13 min read · Observability, Analytics & OLAP, SQL, Performance engineering
  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.

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)
