The billion docs JSON Challenge: ClickHouse vs. MongoDB, Elasticsearch, and more
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.
Related posts
- 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 world’s fastest tool for querying JSON files
ClickHouse easyNovice
clickhouse-local, a single-binary SQL engine for local and remote files, outperforms SPySQL, jq, trdsql, Miller, OctoSQL, spark-sql, Pandas and DSQ when querying large JSON files in the SPySQL benchmark on Amazon book reviews data. The benchmark covers map (computed column over all rows), aggregation (column average) and filter (first 100 matching rows) tasks, and OctoSQL is faster on smaller files. Schema inference and semi-structured data support make the queries simple to write. Caveats: each query runs only once, results vary by hardware, and the filter test favors tools that stop early on LIMIT without loading the whole file.
- Making complex JSON 58x faster, use 3,300x less memory, in ClickHouse
ClickHouse hardMaster
ClickHouse v25.8 adds two new on-disk serializations for the JSON type's shared data, which holds paths beyond the 1,024 dynamic-subcolumn limit. Previously, reading such a path meant loading and filtering an entire Map(String, String) column. A bucketed format hashes paths into separate maps so only one bucket is read. An advanced format adds per-granule .structure, .paths_marks and substream files, so queries can skip granules and seek directly to a path or a nested subcolumn. To keep full-document reads and merges fast, the original map layout is stored alongside the advanced one, roughly doubling storage. On 200k rows with 10k paths, selective reads ran about 58x faster with about 3,300x less memory, and whole-document reads stayed close to the original format.
- Longbridge Technology simplifies their architecture and achieves 10x performance boost with ClickHouse
ClickHouse mediumAdept
Longbridge, a Singapore online brokerage, replaced a fragmented market-data stack of PostgreSQL (historical), Redis (real-time) and DynamoDB (high-write) with ClickHouse after evaluating it against TimescaleDB and TDengine for write throughput, Decimal support, time functions and aggregations. Historical data was migrated via ClickHouse external tables over OSS and Alibaba Cloud DTS, which merged 128 PostgreSQL sub-tables into one table and converted varchar fields to Decimal; Redis was kept for real-time data with ticker-level writes moved to ClickHouse. Reported results include about 5x compression (500GB down to 100GB), 10x faster single-table writes than PostgreSQL, and built-in aggregation and window functions replacing scheduled statistics jobs.
- Do you still need Elasticsearch for log analytics? ClickHouse says no.
ClickHouse mediumAdept
ClickHouse's redesigned inverted-index full-text search feeds matches directly into its vectorized analytical engine, and on a reproducible OpenTelemetry log benchmark at 1B, 10B and 50B rows it ran a nine-query search-plus-aggregation suite 2-6x faster than Elasticsearch, with a much smaller storage footprint. Both systems ran single-node on identical m6i.8xlarge instances with matching sort orders, result caches disabled, and cold and hot runs measured separately. Elasticsearch was tested with Query DSL, which was faster than ES|QL. The storage gap comes from ClickHouse's per-column general-purpose compression and from Elasticsearch's need to keep _source and stored fields. Ingesting 50B rows took under 4 hours in ClickHouse versus about 5 days in a tuned Elasticsearch setup.