hn.today

Shredding JSON columns gave Logfire up to 1000x faster queries

pydantic.dev13 points8 comments
Screenshot of Shredding JSON columns gave Logfire up to 1000x faster queries

Logfire tackled painfully slow queries over OpenTelemetry data by changing how semi-structured attributes are stored and queried. Initially attributes were kept as a single JSON column in Parquet and parsed with the fast Jiter parser, which still forced heavy I/O, poor compression, and expensive JSON parsing whenever queries touched unshredded keys. A prior optimization - static shredding - extracted a small, hardcoded set of common attributes into strongly typed Parquet columns (with _lf_attributes prefixes) so those predicates could benefit from columnar reads and zone-map pruning. That helped some queries but was inflexible, visible to users, added storage overhead for mostly-null columns, and left many predicates paying the full JSON scan cost.

The new approach, dynamic shredding, automatically extracts the most frequently accessed attributes into separate typed columns during ingestion and compaction with no user configuration, preserving the logical JSON view while optimizing the physical layout. By enabling predicate pushdown, min/max pruning, and much smaller column scans, this reduces object-storage downloads and CPU parsing dramatically; queries that previously timed out (30s) now complete in under a second in some cases, with reported speedups up to ~1,000x. The change keeps Parquet for storage, rewrites JSON attribute predicates to use shredded columns when available, and will be rolled out to customers starting February 2026.

Read on pydantic.dev8 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Security

X Is Bad, Though

X Is Bad, Though

Elon Musk's ownership of X has led to increased activity from prominent figures, despite his controversial actions and statements. Musk has repeatedly made offensive remarks, including antisemitic comments and deadnaming his trans daughter, which tarnish his reputation. (lexontech.org)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.