
Langfuse v4, generally available since August 2026, replaces the tracing platform's v3 storage model with a single wide, mostly immutable observations table in ClickHouse. The v3 design split tracing data between traces and observations tables and handled SDK updates as full-row replacement writes, which forced read-time joins and deduplication that degraded sharply at multi-billion-row scale. The v4 redesign concentrates three changes: reduced query scope, real-time propagation of trace-level metadata onto every observation row, and a rewritten public V2 API. This article walks backend engineers through each change and ties it to the specific query patterns it affects, from dashboard table loads to programmatic metrics requests. Migration mechanics and compatibility windows are covered at the end, including the completed November 16, 2026 cutover of Langfuse Cloud to v4-only.

When Langfuse moved from Postgres to ClickHouse in December 2024 (v3), the data model retained a two‑table layout:
traces – stored shared metadata such as user_id, session_id, tags, plus the overall input and output of a request.observations – recorded each atomic operation (LLM calls, tool invocations, etc.) that belongs to a trace.Both tables were created with ClickHouse’s ReplacingMergeTree engine. Because ClickHouse cannot update rows in place, every SDK‑generated update (start/update/end events) was turned into a full‑row replacement insert. The latest row for a given identifier was later deduplicated by background merges, and read‑time queries had to apply FINAL or LIMIT BY to guarantee correctness — a step that bypasses skip‑index optimisations and inflates CPU and memory usage【{"id": 0, "cursor": 0}】.
Typical analytics queries (e.g. “total cost for this user” or “LLM calls in a session”) required joining traces and observations. At a few hundred million rows the join completed in seconds, but as data grew to billions of rows the join:
FINAL/LIMIT BY), further increasing latency and preventing the planner from using skip‑index pruning.The default sorting key (projectId, date) helped prune by project or day, but could not limit the right‑hand side of the join, so queries that needed to filter on tags or session IDs still scanned large portions of the observations table. By late 2025, some customers could only view a few days of data; long‑duration dashboards frequently hit “out‑of‑memory” errors, and tag‑heavy filters forced administrators to raise ClickHouse request‑size limits【{"id": 0, "cursor": 0}】.
Because ClickHouse is not read‑after‑write consistent without expensive settings, Langfuse introduced a Redis cache to store acknowledged events until they were safely persisted. Internal metrics showed that 90 % of updates reached ClickHouse within ten seconds, but the system still needed the cache to avoid race conditions when two updates for the same observation arrived concurrently【{"id": 0, "cursor": 1}】.
| Issue | Root cause | Impact at scale |
|---|---|---|
| Join‑heavy reads | Separate traces + observations tables | Multi‑second latency, OOM failures |
| Full‑row replacements | ReplacingMergeTree requires inserts for updates | Background merge load, need for FINAL/LIMIT BY |
| Inconsistent reads | ClickHouse’s eventual consistency | Required Redis cache, added operational complexity |
| Index erosion | Join filters on right side not pruned | Skip‑index benefits lost, larger request sizes |
These limitations directly motivated the v4 redesign, which consolidates all mutable fields onto each observation row and eliminates the read‑time join and deduplication steps.

Langfuse v4 replaces the previous traces + observations split with a single, wide ClickHouse table named observations. Each row stores a complete LLM call, tool execution, or agent step together with all trace‑level attributes (project ID, user ID, session ID, tags, timestamps, etc.). The table is built on ClickHouse’s MergeTree engine and is defined as mostly immutable: rows are appended once when an observation finishes, and the authoritative ordering key (project → date → observation ID) guarantees a stable sort order that ClickHouse can stream directly from disk 【2†source】.
| Goal | How it is achieved |
|---|---|
| Eliminate joins at read time | All trace metadata is denormalised into each observation row, so a query can retrieve “cost per user” or “LLM calls per session” with a single table scan 【1†source】. |
| Eliminate deduplication at read time | Because observations are written once and never rewritten, there are no duplicate rows to collapse with FINAL. The ordering key becomes authoritative, allowing streaming reads without a scan for newer versions 【5†source】. |
| Optimize for ClickHouse access patterns | The wide, column‑arised layout matches MergeTree’s strengths: predicate push‑down, skip indexes, and efficient compression. Immutable append‑only writes let the engine fully apply its merge optimisations, reducing table‑load latency from seconds to tens of milliseconds 【5†source】. |
traces and observations are now answered by scanning only the observations table, turning cross‑trace analytics into simple column filters.The observation‑centric, wide‑event pattern is not unique to Langfuse. Ivan Burmistrov’s essay “All you need is Wide Events” argues that separating metrics, logs, and traces is artificial; a single attributed‑event table provides the most flexible analysis 【3†source】. Uber’s engineering team arrived at the same conclusion when they rebuilt their logging platform on ClickHouse, adopting a schema‑flexible, wide‑event model that emphasizes an authoritative ordering key and avoids joins 【3†source】.
Version note: The exact column list and DDL are maintained in the official data‑model documentation. Query writers should consult that source rather than rely on this summary, as future releases may add or deprecate columns.

Langfuse v4 shrinks the amount of data a query must scan through three tightly coupled techniques.
1. Join elimination – The legacy V3 schema stored trace‑level metadata in a separate traces table and per‑operation details in observations. Every read required a JOIN between the two tables, which forced ClickHouse to materialize a large intermediate result before filtering could begin. v4 collapses all columns into a single, wide observations table, so the join step disappears entirely from the read path【1†https://langfuse.com/changelog/2026-08-17-langfuse-v4】. The result is a pure column‑scan that can leverage the primary ordering key (projectId, date, …) without extra I/O.
2. Deduplication elimination – In the previous model each observation could be written multiple times (start, end, update). The query engine therefore had to invoke the FINAL modifier or a ReplacingMergeTree scan to guarantee that only the newest row survived, which meant scanning enough data to confirm the absence of newer versions. Experiments showed this required reading hundreds of gigabytes before a result could be emitted【5†https://langfuse.com/blog/2026-03-10-simplify-langfuse-for-scale】. By writing each observation once (or using lightweight updates only for low‑volume edits) the ordering key becomes authoritative, allowing ClickHouse to stream rows directly from disk order and skip the costly deduplication phase. Table‑load latency collapsed from seconds to “tens of milliseconds”【5†https://langfuse.com/blog/2026-03-10-simplify-langfuse-for-scale】.
3. Payload truncation via a materialized view – Raw observation rows can be several megabytes because they embed full input, output, and arbitrary metadata maps. A materialized view copies each incoming event into a derived table that truncates those large fields, keeping only the columns needed for dashboards and list views【2†https://langfuse.com/blog/2026-03-10-simplify-langfuse-for-scale】. The lean table serves the bulk of UI queries, while the full table is queried only when a user drills down into a single observation. This dual‑representation reduces the amount of data scanned for common queries by orders of magnitude and also enables ClickHouse background merges to finish successfully on very wide rows.
A concrete illustration comes from Launch Week 5 (May 2026) after the full‑text search rollout. A “large input/output” search that previously consumed 18 s and read ≈ 494 GB now returns in < 0.5 s while reading < 1 GB【3†https://langfuse.com/launch-week-5】. A metadata‑heavy query dropped from 1.6 s to 0.2 s【3†https://langfuse.com/launch-week-5】. The reduced scan volume is a direct consequence of the three mechanisms above.
Together, these changes let v4 handle multi‑billion‑row workloads without the performance cliffs that plagued v3, while preserving full fidelity for occasional point‑lookups through the untruncated base table.

Denormalising trace data into a single, wide observations table creates a timing problem: trace‑level fields such as user_id, session_id, and tags become known at different moments during a trace’s execution, yet every observation row must contain the final values at write time.
An early design considered writing raw observations to a temporary staging table and later running a nightly batch job to enrich the rows with missing trace attributes. This was dismissed because it would break the real‑time visibility that engineers rely on when debugging live traces. A delayed backfill would introduce gaps of several hours, making the UI and alerting pipelines inconsistent with the source data.
The v4 SDKs now embed trace‑level metadata directly into the OpenTelemetry Context and Baggage that travels with each span. When an observation is created, the SDK reads the current baggage and writes the values into the observation record, guaranteeing that every row carries the full set of attributes at insert time.
user_id or session_id values.Projects that still use older SDK versions continue writing to the legacy traces + observations tables. A background propagation job periodically copies those rows into the new wide table and fills missing attributes. Because this job runs on a short schedule, data from legacy SDKs can be up to 10 minutes stale in the new UI [Langfuse v4 release discussion]. This fallback preserves read‑time correctness while encouraging migration to the newer SDKs.
By the v4 announcement, ≈ 60 % of Langfuse Cloud observations already arrived via the OpenTelemetry endpoint [Langfuse blog on scale]. Those spans are immutable, meaning the ingest path is already append‑only and can tolerate immediate attribute enrichment without additional mutations.
With trace attributes materialised at write time, queries such as “spend by user this week” become simple filters on a column that is always present, eliminating the eventual‑consistency backfill problem that existed in v3. The ClickHouse engine can now scan a single wide table, applying the filter directly, which reduces query latency from seconds to milliseconds for dashboards and programmatic metric requests.
Scope note: The broader OpenTelemetry migration story is detailed in a companion article; this section focuses solely on the propagation mechanism introduced in v4.

The original public endpoints (GET /api/public/traces and GET /api/public/traces/:id) returned traces together with their scores and observations, but they offered only limited pagination and did not require a time filter. Because ClickHouse orders data by project_id + timestamp, a query without a time predicate forces the engine to scan every part of the project, effectively a full‑table scan 【6†L3-L9】. Even though later versions added opt‑in field‑selection and deduplication flags, the default behaviour remained unsafe at scale 【6†L10-L13】.
V2 rewrites the contract to match ClickHouse’s strengths:
filter parameter must contain a time range, enabling ClickHouse to prune partitions based on its ordering key 【6†L15-L18】.Filters are supplied as a URL‑encoded JSON array. For string fields, only exact‑match (=) and the matches token‑search operator are supported; substring operators (contains, starts with, ends with) are rejected with HTTP 400 because they would require full‑content scans 【5†L1-L8】. The matches operator performs token‑level search and is case‑insensitive for input/output fields 【5†L9-L12】.
Rate limits are now plan‑aware and split per endpoint. According to the pricing reference, the Observations API v2 allows 30 / 100 / 1 000 requests per minute for Hobby, Core, and Pro tiers respectively, while the Metrics API v2 is limited to 100 requests per day (Hobby), 100 requests per hour (Core), and 500 requests per hour (Pro) 【4†L1-L12】.
These constraints turn the API contract into a query‑shape guarantee: every request can be satisfied by ClickHouse’s partition pruning and column‑arithmetic without costly joins or full scans, delivering predictable latency even on multi‑billion‑row projects.
Version‑sensitive note: The V2 endpoints entered public beta before the v4 GA release (August 2026) and the filter schema, as described in the API reference, may evolve. Rate‑limit values are subject to change with future pricing updates.

The immutable, append‑only observations table is the single point where every LLM call, tool execution, and agent step lands. Because rows are never overwritten, ClickHouse can treat the table as a classic time‑series store and apply optimisations that would be unsafe on mutable data.
Immediate benefits
Observation‑level evaluations now run in seconds instead of spawning a separate ClickHouse query for each evaluation, turning a previously linear‑time operation into a single bulk scan Langfuse v4 Release Announcement.
Full‑text search was added during Launch Week 5 and is powered by ClickHouse’s GA‑grade text index. The UI can locate a specific phrase across millions of observations in under half a second, and the same capability is exposed programmatically via the matches operator on Observations API v2 Launch Week 5 blog.
New UI primitives—the filter/search bar, configurable alerts, and deterministic code evaluators—were made possible by the ability to scan a single denormalised table without joins Langfuse August 2026 Update.
Agent‑centric features
The Langfuse Assistant entered public beta in June 2026, letting users query traces, metrics, and evaluations in natural language. Internally it reuses the Observations API v2, so the same token‑based matches search works for both humans and scripts Langfuse Assistant beta announcement. Example queries include “average latency per day last week” or “token spend broken down by model”.
Future‑proofing with materialised views
Because the data never changes after write, Langfuse can safely materialise pre‑aggregated views (e.g., daily cost per model or per‑user latency percentiles). The architecture explicitly calls this out as a next step; materialised views will let teams offload repetitive aggregation work to ClickHouse while keeping the underlying table immutable Langfuse v4 changelog.
Design implications
The immutability contract should be the primary architectural decision point. Workflows that rely on mutating trace rows—such as retroactively changing production labels—must be refactored. The only supported mutations are lightweight UI actions (e.g., bookmarking) that translate to tiny, low‑volume updates. Treating observations as write‑once records enables the performance gains described above and opens the path to richer analytics, monitoring, and agent‑driven querying layers.

Langfuse Cloud switched to v4‑only on 16 Nov 2026. From that moment the legacy v3 tables were no longer written to, and the UI displayed only data from the new observations table 【1†https://langfuse.com/changelog/2026-08-17-langfuse-v4】. The cut‑over has already completed, and the platform now enforces the v4 data model for all Cloud tenants.
For Cloud projects that did need changes, Langfuse provides an in‑app Migration Assistant in the sidebar. It generates a project‑specific checklist that includes actions such as:
providedModelName → model).observations table.The assistant also shows a preview of required code changes and links to the relevant migration guides. Completing the checklist before the cut‑over guarantees uninterrupted service; otherwise, the project continues to write to the legacy tables, which are still readable in the UI but appear with a ≤ 10 minute delay and miss real‑time metadata propagation 【0†https://langfuse.com/blog/2026-09-30-langfuse-september-update】.
Self‑hosted installations are not subject to a forced cut‑over; operators can upgrade on their own schedule. Langfuse supplies a self‑host preview guide that details the new ClickHouse schema, required ClickHouse version, and resource sizing 【5†https://github.com/orgs/langfuse/discussions/14157】. The guide deliberately excludes a side‑by‑side deployment‑option comparison, which is covered in a companion article.
The usual “current + previous major” SDK support guarantee is broken by the v4 transition. The Python SDK v4—released in Mar 2026—was a full rewrite, introducing breaking changes for any code still using the v3 client 【2†https://pypi.org/project/langfuse/】. The JavaScript/TypeScript ecosystem follows a similar path, with SDK v5 required to consume the v4 API 【6†https://github.com/orgs/langfuse/discussions/12518】. The feature‑availability matrix lists the exact deprecation schedule for older SDK majors.
Official migration guides are available:
Because older SDKs continue to write to the legacy tables, their data becomes visible in the new UI only after a brief ingest window and lacks the real‑time trace‑level metadata that v4 propagates to every observation row 【6†https://github.com/orgs/langfuse/discussions/12518】.
Backend teams should coordinate SDK upgrades with the v4 migration:
The exact actions vary per project; the Migration Assistant’s checklist remains the authoritative source for required changes.