Trace Storage: How Much Index Can You Afford?
The Access Pattern, Precisely
Writes are enormous, append-only, never updated, and never deleted except by TTL expiry. And the thing that makes them awkward is the Trace part's mismatch showing up again: one trace arrives as N independent writes, scattered across time and across writer processes. The storage layer never sees a trace. It sees 40 unrelated rows that happen to share a key, arriving over a window of hundreds of milliseconds, possibly from different collector instances. There is no transaction, no completeness signal, and no "trace is done" event to trigger on.
Reads come in exactly two shapes, and they could not be more different:
Get trace by ID — a point lookup on a 16-byte key returning ~40 rows. Any KV store on earth does this in single-digit milliseconds. Cassandra, S3+bloom filter, Redis, a filesystem with the ID as the path — all fine.
Find traces matching a predicate — service = checkout AND operation = POST /pay AND duration > 2s AND tag[customer.tier] = "enterprise" AND time IN last 1h, returning the N most recent matches. This is a multi-dimensional range query over a write-saturated dataset. This is the entire problem.
If you only ever needed lookup-by-ID, trace storage would be a solved, boring problem — and the fact that it isn't boring is the whole reason four different architectures exist. Meanwhile the read rate is minuscule: a few thousand searches a day against tens of billions of stored spans. Most stored traces are never read by anyone. That asymmetry — writes ~107× reads — is what makes an index-free design not just viable but arguably correct.
Pattern 1 — Jaeger on Cassandra: Hand-Built Inverted Indexes
Cassandra has no secondary indexes worth using, so Jaeger writes its own. The schema (internal/storage/v1/cassandra/schema/v004.cql.tmpl in the Jaeger repo — it moved from the old plugin/storage/cassandra/schema path) is a data table plus five explicit inverted-index tables:
traces PRIMARY KEY (trace_id, span_id, span_hash) TWCS
← the only table a get-by-ID touches
service_names PRIMARY KEY (service_name) STCS
operation_names_v2 PRIMARY KEY ((service_name), span_kind, operation_name)
← powers the UI's two dropdowns. Note: _v2.
service_name_index PRIMARY KEY ((service_name, bucket), start_time) TWCS
service_operation_index PRIMARY KEY ((service_name, operation_name), start_time)
duration_index PRIMARY KEY ((service_name, operation_name, bucket),
duration, start_time, trace_id) TWCS
tag_index PRIMARY KEY ((service_name, tag_key, tag_value),
start_time, trace_id, span_id) TWCS
dependencies_v2 PRIMARY KEY (ts_bucket, ts) ← §11's service graph
operation_throughput ─┐
sampling_probabilities ├─ adaptive sampling state (see: Jaeger Architecture) — no TTL
leases ─┘ leases = the leader lock for probability calcEvery index table's partition key is a bucketed composite. That is not decoration: without bucket, service_name_index for your busiest service would be a single unbounded partition accumulating 400 million rows a day, and Cassandra partitions that large are an operational death sentence. The clustering key is start_time descending, because the query is always "most recent N."
writes per span = 1 (traces) + 3 (service, operation, duration indexes) + k (indexed tags)
one span with 10 indexed tags = 14 partition writes
This is why every Jaeger-on-Cassandra deployment caps its indexed tag list, and why the advice in the Span and Instrumentation parts that span names must be low-cardinality is a storage constraint and not an aesthetic one. It also explains a counter-intuitive operational fact: adding one popular indexed tag can increase your Cassandra write load by more than doubling your traffic would.
Pattern 2 — Jaeger on Elasticsearch/OpenSearch: Index Everything
The opposite bet. Each span is a document; Jaeger writes into rolling indices (jaeger-span-YYYY-MM-DD by default, or ILM-managed rollover aliases) and Elasticsearch inverts essentially every field. The query story is dramatically better — arbitrary tag predicates, free-text on operation names, aggregations, no pre-declared index list — and you pay for it in three places at once:
| Cost | What actually happens |
|---|---|
| Disk | Inverted index + doc values + the _source document. Total on-disk size frequently exceeds the raw JSON — the opposite of the 10:1 columnar compression in the What It Costs part. |
| Index CPU | Analysis and inversion happen on the ingest path, synchronously. At 400k spans/s this is the dominant cost of the cluster, and it's paid on write — i.e. on the 99% of traces nobody reads. |
| Operations | Shard sizing, heap pressure, mapping explosion from unbounded tag keys, forced merges, and the standard complaint: a dedicated ES cluster for tracing is expensive and demands a person who knows ES. |
Retention is index-level, not row-level, which is genuinely better than Cassandra's tombstones: jaeger-es-index-cleaner (or an ILM delete phase) drops whole indices, a metadata operation. Mapping explosion is the real hazard — spans carry arbitrary tag keys, and if those are mapped as fields rather than nested key/value pairs, one service emitting user_<id>: true style tags will take the cluster down. Jaeger stores tags as nested arrays specifically to prevent this; --es.tags-as-fields.all turns the protection off, and you should know why before you set it.
Cassandra
Cheap, predictable writes. Rigid queries — you can only ask what you built a table for. Scales linearly and boringly. Adding a query shape means adding a table and backfilling.
Elasticsearch
Flexible queries, arbitrary predicates, real aggregations. Expensive on every axis — disk, CPU, RAM, and headcount. You are paying to index 34 billion documents a day so you can search a few thousand.
Pattern 3 — Grafana Tempo: Delete the Index
Tempo takes the asymmetry seriously and draws the conclusion nobody else did: if reads are 10-7 of writes, an index you maintain on every write is the wrong place to spend money. Tempo keeps no inverted index at all. Blocks go to object storage (S3/GCS/Azure) in Apache Parquet — the vParquet family, currently vParquet4 by default with vParquet5 production-ready — and the only lookup structure is a set of bloom filters on trace ID, sharded and aggressively cached.
The original discovery path was explicitly indirect: you were expected to find the trace ID somewhere else first — a metric exemplar, a log line carrying trace_id, Grafana's trace-to-logs linkage — and then ask Tempo only "fetch this ID." Cost per GB retained collapses by roughly an order of magnitude against Elasticsearch, because object storage is object storage.
Then TraceQL arrived and Tempo had to support real search without the index it had refused to build. The mechanism is brute force, done well:
The query-frontend takes one TraceQL query and shards it into jobs — one job per unit of block data, sized by
query_frontend.search.target_bytes_per_job(Grafana recommends 100–200 MB; the floor is a single Parquet row group). A search over a wide time window becomes thousands of jobs.Jobs are batched (
query_frontend.max_batch_size, default 7) and queued. Queriers consume them in parallel, each runningquerier.max_concurrent_queriesat a time.query_frontend.search.concurrent_jobscaps how much of the fan-out is in flight.Each job reads only the Parquet columns the predicate touches, and prunes row groups by column min/max statistics. Dedicated attribute columns — 10 string spares per scope in vParquet4, 20 strings plus 5 integers in vParquet5 — let you promote your hot query attributes out of the generic key/value columns into first-class ones, which is the difference between scanning a column and scanning a map.
Tempo replaced index cost with scan cost. That is the right trade precisely when reads are rare and object storage is cheap — you pay a large, elastic, burst-shaped compute bill on the few thousand searches you actually run, instead of a permanent write-path tax on all 34 billion daily spans.
Tempo 3.0 (released May 2026) went further and rebuilt the write path around Kafka: distributors write to Kafka partitions sharded by trace ID; block-builders consume and flush Parquet blocks; live-stores consume the same stream and serve the most recent ~30–60 minutes. The ingester is gone entirely. The motivating number is worth carrying: the old replication-factor-3 ingester design produced 2–2.5× data duplication in object storage, and the Kafka path runs at RF1 with each block built exactly once.
Pattern 4 — ClickHouse: Columnar OLAP, Skip Indices Instead of Inverted Ones
Used by SigNoz, Uptrace, and several vendors, and available directly as the OTel Collector's clickhouse exporter. Spans become wide rows in a MergeTree table; there is no inverted index, only ClickHouse's data-skipping indices, which prune granules rather than locating rows:
ORDER BY (ServiceName, SpanName, toDateTime(Timestamp))
PARTITION BY toDate(Timestamp)
SpanName LowCardinality(String) CODEC(ZSTD(1)) -- dictionary-encoded
ResourceAttributes Map(LowCardinality(String), String)
INDEX idx_trace_id TraceId TYPE bloom_filter(0.001)
INDEX idx_span_attr_key mapKeys(SpanAttributes) TYPE bloom_filter(0.01)
INDEX idx_span_attr_value mapValues(SpanAttributes) TYPE bloom_filter(0.01)
INDEX idx_duration Duration TYPE minmax
SETTINGS index_granularity=8192, ttl_only_drop_parts = 1Three things to notice. LowCardinality(String) on SpanName and ServiceName is the same low-cardinality bet as everywhere else in this guide, made explicit in the type system — violate it and compression collapses. ttl_only_drop_parts = 1 is ClickHouse's version of Tempo's and TWCS's insight: expire by dropping whole parts, never by rewriting them. And because trace-ID lookup would otherwise require scanning every partition, the exporter maintains a separate <table>_trace_id_ts materialised view mapping trace ID to a time range — a purpose-built, one-column index, which is exactly the concession every index-free design eventually makes.
The Four Designs, Side by Side
| Cassandra | Elasticsearch | Tempo + object store | ClickHouse | |
|---|---|---|---|---|
| Write cost | Low per write, but ×(4+k) amplification | High — inversion on the ingest path | Lowest — append Parquet, no index build | Low — batched columnar inserts |
| Index cost | 5 hand-built tables you maintain | Everything, by default | Bloom on trace ID only | Skip indices + bloom, granule-level |
| Ad-hoc query | Only the shapes you built tables for | Excellent, anything | TraceQL by scan — flexible but not instant | Full SQL, very good |
| Cost per GB retained | Medium (replicated SSD) | Highest | Lowest — ~an order of magnitude under ES | Low — best-in-class compression |
| Search latency | Fast on indexed shapes, impossible off them | Sub-second | Seconds to minutes, scales with workers | Sub-second to seconds |
| Ops burden | Medium — compaction, tombstones, repairs | High — the classic complaint | Low storage, but a real microservice fleet | Medium — one cluster, many knobs |
| Actually good at | Huge sustained writes with a fixed, known query set | Exploratory search when budget is not the constraint | Retaining enormous volumes cheaply when discovery starts from a metric or log | Traces as an analytics dataset — SQL over spans, joins, aggregations |
- Guarantees: Get-trace-by-ID is a cheap point lookup in every design here, and TTL-based expiry eventually reclaims space in all four — provided the compaction/part-drop strategy matches the time-series access pattern (TWCS, index rollover, block deletion,
ttl_only_drop_parts). - Does not guarantee: That a stored trace is complete. Storage receives N independent span writes with no completeness signal (see The Trace); a late or dropped span leaves a permanently partial trace that no query can distinguish from a genuinely short one. Nor does any of these designs guarantee that a predicate search is cheap — that is precisely what you are choosing an architecture to trade against.