Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Benchling Engineering 10 min read Case study mediumAdept

Scaling Scientific Data: Migrating Benchling’s Schema Model for Performance at Scale

Benchling replaced its PostgreSQL entity-attribute-value (EAV) storage for schema field values with a single JSONB column per entity, cutting row counts and per-row overhead that had slowed automated assay-result ingestion. Instead of a GIN index, which would slow inserts, entity linkages live in a separate table keyed by attribute name. The tradeoffs were more row-level lock contention, harder per-field queries and looser typing. The three-year migration ran in stages: dual writes with nightly integrity checks, then switching reads to JSONB, then removing the EAV tables. It produced up to 7x faster ingestion, roughly 2x faster analysis queries, and duplicate checks that dropped from minutes to 10-20 ms.

Assumes: PostgreSQL basicsrelational data modelingrow-level locking

Related posts

  • Migrating JSONB columns in Go

    incident.io mediumAdept

    When a JSONB column's shape changes, a custom sql.Scanner and driver.Valuer on the Go column type can read both the old and new formats while always writing the new one. incident.io used this to move conditions from a flat array to an array of condition groups, which was needed to support OR logic. Old flat arrays are wrapped in a single group on read, so backend and frontend work could proceed before the data migration finished. The backfill then reads and rewrites rows in batches of 1,000 via a GORM upsert (ON CONFLICT DO UPDATE), tracked by a temporary indexed conditions_migrated column, after which the compatibility scanner is removed.

  • What really matters for performance: lessons from a year of benchmarks

    ClickHouse easyNovice

    Six ClickHouse benchmarks from 2025 point to one conclusion: performance depends on how efficiently an engine moves data end-to-end. JSONBench showed columnar JSON storage running orders of magnitude faster than document stores like MongoDB on up to 1B Bluesky events. FastFormats found the Native format, LZ4 compression and large batches matter most for ingestion, and Netflix used those results to reach ~5 PB/day of log ingestion. A distributed cache matched or beat local SSDs on object storage, lightweight SQL UPDATEs ran up to 1,000× faster than mutations, and parallel replicas aggregated 100B rows in ~0.4s.

  • The billion docs JSON Challenge: ClickHouse vs. MongoDB, Elasticsearch, and more

    ClickHouse mediumAdept

    JSONBench is a reproducible benchmark that loads up to one billion Bluesky event JSON documents into ClickHouse, MongoDB, Elasticsearch, DuckDB and PostgreSQL, then measures storage size and the speed of five analytical queries. ClickHouse's columnar JSON type stores each JSON path as a separate compressed column. In these tests it used 40% less storage and ran aggregations 2500x faster than MongoDB, used half the storage and ran 10x faster than Elasticsearch, and was several thousand times faster than DuckDB and PostgreSQL while using 5-6x less disk. The write-up explains each system's JSON storage model, compression, sorting, indexes and caches, and how each was configured for a fair comparison, such as MongoDB covered index scans and Elasticsearch with _source disabled.

  • Bloom filters: the niche trick behind a 16× faster API

    incident.io mediumAdept

    incident.io cut P95 latency of its alert-filtering API for large organisations from 5s to 0.3s by pushing JSONB attribute filters into Postgres using bloom filters. Attribute key-value pairs are string-encoded, hashed with seven hash functions into a 512-bit bitmap stored as a bit(512) column, and queried with bitwise AND against bitmasks. With a 1% false-positive rate, only about 1% of the previous in-memory deserialization work remains. The bottleneck had been fetching and deserializing 500-row batches into Go structs. The team spiked a GIN index with jsonb_path_ops as the alternative and benchmarked both options before choosing.

  • Top 3 features in Postgres 17

    Neon mediumAdept

    Postgres 17 adds RETURNING support to MERGE (with a merge_action() function that reports whether each row was inserted, updated or deleted), SQL/JSON functions including JSON_TABLE for turning JSON into relational rows, and performance work. On the performance side, vacuum uses a new data structure that cuts memory use by up to 20x and lifts the 1GB cap, and B-tree scans handle IN-lists faster. Neon engineers contributed to EXPLAIN (SERIALIZE), parallel BRIN index builds, direct TLS handshakes, event triggers on client connect, and amcheck validation of B-tree uniqueness.

The quest for software engineering knowledge.

Look:
Layout: