pgrust: Postgres analytics 300x faster with batching, SIMD, operator fusion

Original: Making Postgres 300x faster for analytics: batching, operator fusion, and SIMD

Why This Matters

Demonstrates that wire-compatible Postgres performance can match or exceed purpose-built analytical engines like ClickHouse.

pgrust v0.2 achieves 300x faster performance than Postgres on ClickBench analytics benchmarks and 30% faster on OLTP. Key techniques include batched processing, operator fusion, and SIMD — even outperforming ClickHouse on some queries.

The pgrust project released version 0.2, delivering major performance gains over standard PostgreSQL. On OLTP benchmarks, pgrust runs 30% faster than Postgres; on ClickBench — ClickHouse's analytical database benchmark — pgrust is 300x faster than Postgres and even surpasses ClickHouse itself. The query engine alone accounts for roughly 10x of that 300x total improvement.

The core argument is architectural: Postgres was designed in the 1980s when disk I/O was the primary bottleneck. Today, many datasets fit entirely in RAM, NVMe storage is hundreds of times faster than HDDs, and analytical workloads are bottlenecked by CPU and memory bandwidth instead. Postgres's query engine has not been fundamentally redesigned to address this shift.

As a concrete illustration, summing 500 million floats in Postgres takes ~20 seconds on a c8g.4xlarge instance (parallel queries disabled). An equivalent Rust loop over a Vec<f64> completes in 358ms — roughly 55x faster — and the gap can be pushed further with additional optimizations.

The pgrust team identified major overhead sources in Postgres including tuple locking and storage format parsing. Their query engine redesign applies three primary techniques: batching (processing rows in bulk rather than one at a time), operator fusion (combining multiple query operators to reduce intermediate data passes), and SIMD (leveraging CPU vector instructions for data-parallel computation). These optimizations reduce both CPU usage and memory bandwidth per query.

Source

malisper.me — Read original →