Skip to content

pgrust v0.2: Now faster than Postgres and Clickhouse

Latest

Choose a tag to compare

@malisper malisper released this 30 Jul 15:36

Releasing pgrust v0.2. This is the fast version of pgrust, our Postgres rewrite from C to Rust. pgrust v0.2 is faster than Postgres and Clickhouse.

Performance

Measured on c8g.4xlarge (AWS Graviton4) against PostgreSQL 18.3.

On the ClickBench combined score, pgrust scored 18.5% faster than ClickHouse
and hundreds of times faster than PostgreSQL. This was using pgrcolumnar,
pgrust's builtin columnar layout.

On sysbench-oltp, pgrust achieved 30% higher throughput than Postgres 18.3 on
read-only workloads at 300GB scale.

These runs were reviewed independently by Greg Smith, author of
PostgreSQL 9.0 High Performance.

Two honest caveats. We had previously reported that pgrust was over 50%
faster than Postgres. On Kubernetes we measure a larger OLTP gap, 50-60%
rather than 30%, and we have not isolated why the same binaries behave
differently there than on bare EC2, so we quote the lower number. Second, the
binaries we publish are generic for their architecture. The benchmark numbers
come from builds tuned for Graviton4 (-Ctarget-cpu=neoverse-v2), so you
will not reproduce them exactly from a download.

Benchmarks and durability settings are unchanged from a default install:
fsync is on. The harnesses are in benchmarks/ so you can
run them yourself.

What's new in v0.2

Executor

  • A new vectorized, push-based executor with JIT compilation.
  • A JIT that emits machine code directly, cutting compile time from ~50ms to
    ~5µs. It currently targets neoverse-v2 (Graviton4) only.
  • A cache-optimized hash table that adapts its strategy to maximize L1/L2
    hits. Used for aggregations today.

Parallelism

  • Threads instead of processes, for both connections and parallel query.
  • A query scheduler, new to Postgres. Queries get a priority, and
    long-running queries have theirs lowered, so heavy queries interfere less
    with fast ones.
  • Parallel query rebuilt around work stealing: idle threads are assigned
    dynamically to speed up queries already in flight.

Storage

  • pgrcolumnar, a column-oriented format with dictionary encoding and
    several other compression schemes.
  • Pipelined fsync. A worker releases its locks after calling fsync but
    before it completes. This is safe because the query is not acknowledged,
    and none of its effects are observable, until the fsync finishes. It
    speeds up highly contended updates by 30-50x.

Other

  • A built-in OOM killer. Near the machine's memory limit, pgrust picks a
    worker to kill, so that one query dies and the server itself can keep
    running.
  • Executable layout optimized with PGO