---
title: "LangChain - Why we Choose ClickHouse to Power LangSmith"
description: "LangSmith, LangChain's LLM observability and evaluation platform, began fully on Postgres but outgrew it as users logged most of their production traces: ingestion lagged, precomputed materializations were rigid and costly, and lock contention grew."
url: "https://swe.quest/articles/langchain-why-we-choose-clickhouse-to-power-langsmith-5117f6fe7184a57a"
canonical: "https://clickhouse.com/blog/langchain-why-we-choose-clickhouse-to-power-langchain"
source: "ClickHouse"
published: "2024-04-23"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["analytics","observability","llms","postgres","databases"]
---

# LangChain - Why we Choose ClickHouse to Power LangSmith

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2024-04-23, 9 min read, Case study. Original: [https://clickhouse.com/blog/langchain-why-we-choose-clickhouse-to-power-langchain](https://clickhouse.com/blog/langchain-why-we-choose-clickhouse-to-power-langchain)

## Summary

LangSmith, LangChain's LLM observability and evaluation platform, began fully on Postgres but outgrew it as users logged most of their production traces: ingestion lagged, precomputed materializations were rigid and costly, and lock contention grew. LangChain added ClickHouse rather than Druid or Pinot because it accepts plain INSERTs without Kafka-based ingestion services and runs locally, self-managed and in the cloud. Lessons include designing sorting keys carefully, using ReplacingMergeTree for updates, and leaning on EXPLAIN because the query planner is less forgiving than Postgres. For trace-ID lookups outside the sorting key, materialized views act as an inverted index that maps trace and run IDs to the main table's sorting-key values, avoiding full scans more simply than bloom-filter skip indices.

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)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)

## Prerequisites

- OLAP databases ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- ClickHouse sorting keys ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- materialized views

## Keywords

ClickHouse, LangSmith, LangChain, ReplacingMergeTree, PostgreSQL, ClickHouse Cloud, Redis

## Related posts

- [How Langfuse is scaling LLM observability for the agentic era with ClickHouse Cloud](https://swe.quest/articles/how-langfuse-is-scaling-llm-observability-for-the-agentic-era-with-clickhouse-f7eb3fab8bbd30ed.md): ClickHouse · 2026-02-03 · Medium · 8 min read · Analytics & OLAP, Observability, LLMs, PostgreSQL, Scaling
  Langfuse moved its LLM tracing data from a single-node Postgres instance to ClickHouse after ingestion growth caused timeouts, high IOPS costs and slow SDK ingestion.
- [How Respan is scaling LLM observability with ClickHouse Cloud](https://swe.quest/articles/how-respan-is-scaling-llm-observability-with-clickhouse-cloud-a4578d78266aa225.md): ClickHouse · 2026-04-06 · Medium · 6 min read · Analytics & OLAP, Observability, PostgreSQL, LLMs
  Respan, an AI gateway with built-in LLM observability processing about 50 million events per day, moved ingestion and analytics from Postgres to ClickHouse Cloud after per-request transactional inserts began contending at 50-100 writes per second.
- [Introducing Postgres Query Insights in ClickHouse Cloud](https://swe.quest/articles/introducing-postgres-query-insights-in-clickhouse-cloud-a9697a827409b984.md): ClickHouse · 2026-05-07 · Medium · 7 min read · PostgreSQL, Observability, Performance engineering, Analytics & OLAP
  Postgres Query Insights, now in preview for ClickHouse Cloud Managed Postgres, ranks every normalized query pattern by impact and aggregates per-execution counters (CPU, cache vs disk reads, temp spills, unlaunched parallel workers, WAL) to explain why a pattern is slow.
- [How we used ClickHouse to store OpenTelemetry Traces and up our Observability Game](https://swe.quest/articles/how-we-used-clickhouse-to-store-opentelemetry-traces-and-up-our-observability-b78dc8bc485a8f13.md): ClickHouse · 2023-04-14 · Medium · 13 min read · Observability, Analytics & OLAP, SQL, Cost optimization
  Resmo stores over 300 million unsampled OpenTelemetry spans per day in a self-hosted ClickHouse node, after dropping S3/Parquet/Athena because of its 2-3 second query startup and delayed data.
- [Lago - Using ClickHouse to Scale an Events Engine](https://swe.quest/articles/lago-using-clickhouse-to-scale-an-events-engine-c476ec4bca3b5c9d.md): ClickHouse · 2024-05-29 · Medium · 7 min read · Analytics & OLAP, PostgreSQL, Payments & fintech, Performance engineering, Databases
  Lago, an open-source usage-based billing platform ingesting millions of events per minute, moved its streamed billable events from Postgres to ClickHouse Cloud and kept Postgres for all other transactional data.

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)
