Last week, version 0.2 of pgrust was released, focusing on performance improvements to the query engine. According to the source text, this release is 10x faster than the previous version of pgrust. On OLTP benchmarks, pgrust is 30% faster than standard Postgres, and on Clickbench—ClickHouse’s benchmark for analytical databases—pgrust is 300x faster than Postgres, even surpassing ClickHouse itself. The query engine improvements alone contributed approximately 10x of the total 300x speedup. The author explains that Postgres was designed in the 1980s when disk I/O was the primary bottleneck, but modern trends—datasets fitting in RAM, analytical workloads emphasizing CPU and memory throughput, and faster storage like NVMe—have shifted the performance bottleneck to CPU and memory bandwidth. To demonstrate the inefficiency of the traditional Postgres query engine, a simple summation query over 500 million numbers took ~20 seconds in Postgres, while an equivalent raw Rust loop completed in 358ms—about 55x faster. After removing non-query-engine overhead via a miniature Volcano-model implementation, the same query took 1.3s. The first optimization, batching rows in chunks of 1024, reduced execution time to approximately 480ms by minimizing function call overhead and enabling better CPU pipelining. The batch buffer is stack-allocated to avoid costly memory allocations during execution. Profiling revealed that memcpy operations (copy_from_slice) became the new hotspot, indicating further optimization opportunities. The text notes that operator fusion and SIMD vectorization are additional techniques used to approach the performance of a hand-optimized Rust loop, though specific implementation details for those are not included in the provided excerpt. All performance claims are tied to the pgrust 0.2 release and its comparison with Postgres and ClickHouse under the specified benchmarks.

Key facts
- pgrust version 0.2 is 10x faster than its previous version
- On OLTP benchmarks, pgrust is 30% faster than Postgres
- On Clickbench, pgrust is 300x faster than Postgres and ahead of ClickHouse
- Query engine optimizations account for ~10x of the 300x speedup
- A 500-million-row SUM query takes ~20s in Postgres, 358ms in a raw Rust loop, and 1.3s in a miniature Volcano-model query engine
- Batching with a buffer size of 1024 reduces query time from 1.3s to ~480ms
- The batch buffer is stack-allocated to avoid runtime memory allocations
