malisper/pgrustPublic

Postgres rewritten in Rust, now faster than Postgres and Clickhouse

AI summary: A high-performance Rust reimplementation of PostgreSQL 18 designed to be 300x faster for analytics.

Stars
5.9K
+127 today
Forks
241
Watchers
49
Open issues
61
Open PRs
3
Contributors
~1
Commits
4
Branches
5

RustAGPL-3.0Created Apr 20, 2026Last push 2d agoLatest release v0.4-beta+146 stars this week+655 this month

Quick answers

What is pgrust?
A high-performance Rust reimplementation of PostgreSQL 18 designed to be 300x faster for analytics.
What does pgrust do?
pgrust is an ambitious ground-up rewrite of PostgreSQL 18.3 in Rust, prioritizing execution speed and demonstrating what Postgres would look like if built today. It achieves full wire and SQL dialect compatibility, passing all 46,066 official Postgres regression tests to ensure strict behavioral parity with the original C implementation. The project leverages Rust's safety to introduce a new vectorized push-based JIT compiled executor, a thread-based concurrency model, and a custom query scheduler. These architectural changes allow it to outperform both standard Postgres and ClickHouse on specific analytics benchmarks when tuned for Graviton4 processors.
Who is pgrust for?
Database engineers, backend developers, and performance researchers looking for a highly optimized, memory-safe alternative to standard PostgreSQL. Familiarity with ai-assisted-development workflows is highly recommended for optimal usage.
How do I get started with pgrust?
initdb -D /tmp/pgrust-data --no-locale --encoding UTF8 -U postgres
How popular is pgrust on GitHub?
malisper/pgrust has 5,937 stars and 241 forks on GitHub, and gained 146 stars in the last 7 days.
What license does pgrust use?
malisper/pgrust is released under the AGPL-3.0 license.

Star history

since Jul 29, 2026
02K4KJul 2026Sep 2026Oct 2026Nov 2026
5.9K stars as of Nov 19, 2026. Measured daily since Jul 29, 2026; GitHub no longer exposes earlier star timestamps.

Update history

1 recorded
  • Oct 25, 2026New release v0.4-beta (previously v0.3).

Contribution activity

commits per day, last 52 weeks
NovDecJanFebMarAprMayJunJulAugSepOctNovMonWedFri2025-11-23: 0 commits2025-11-24: 0 commits2025-11-25: 0 commits2025-11-26: 0 commits2025-11-27: 0 commits2025-11-28: 0 commits2025-11-29: 0 commits2025-11-30: 0 commits2025-12-01: 0 commits2025-12-02: 0 commits2025-12-03: 0 commits2025-12-04: 0 commits2025-12-05: 0 commits2025-12-06: 0 commits2025-12-07: 0 commits2025-12-08: 0 commits2025-12-09: 0 commits2025-12-10: 0 commits2025-12-11: 0 commits2025-12-12: 0 commits2025-12-13: 0 commits2025-12-14: 0 commits2025-12-15: 0 commits2025-12-16: 0 commits2025-12-17: 0 commits2025-12-18: 0 commits2025-12-19: 0 commits2025-12-20: 0 commits2025-12-21: 0 commits2025-12-22: 0 commits2025-12-23: 0 commits2025-12-24: 0 commits2025-12-25: 0 commits2025-12-26: 0 commits2025-12-27: 0 commits2025-12-28: 0 commits2025-12-29: 0 commits2025-12-30: 0 commits2025-12-31: 0 commits2026-01-01: 0 commits2026-01-02: 0 commits2026-01-03: 0 commits2026-01-04: 0 commits2026-01-05: 0 commits2026-01-06: 0 commits2026-01-07: 0 commits2026-01-08: 0 commits2026-01-09: 0 commits2026-01-10: 0 commits2026-01-11: 0 commits2026-01-12: 0 commits2026-01-13: 0 commits2026-01-14: 0 commits2026-01-15: 0 commits2026-01-16: 0 commits2026-01-17: 0 commits2026-01-18: 0 commits2026-01-19: 0 commits2026-01-20: 0 commits2026-01-21: 0 commits2026-01-22: 0 commits2026-01-23: 0 commits2026-01-24: 0 commits2026-01-25: 0 commits2026-01-26: 0 commits2026-01-27: 0 commits2026-01-28: 0 commits2026-01-29: 0 commits2026-01-30: 0 commits2026-01-31: 0 commits2026-02-01: 0 commits2026-02-02: 0 commits2026-02-03: 0 commits2026-02-04: 0 commits2026-02-05: 0 commits2026-02-06: 0 commits2026-02-07: 0 commits2026-02-08: 0 commits2026-02-09: 0 commits2026-02-10: 0 commits2026-02-11: 0 commits2026-02-12: 0 commits2026-02-13: 0 commits2026-02-14: 0 commits2026-02-15: 0 commits2026-02-16: 0 commits2026-02-17: 0 commits2026-02-18: 0 commits2026-02-19: 0 commits2026-02-20: 0 commits2026-02-21: 0 commits2026-02-22: 0 commits2026-02-23: 0 commits2026-02-24: 0 commits2026-02-25: 0 commits2026-02-26: 0 commits2026-02-27: 0 commits2026-02-28: 0 commits2026-03-01: 0 commits2026-03-02: 0 commits2026-03-03: 0 commits2026-03-04: 0 commits2026-03-05: 0 commits2026-03-06: 0 commits2026-03-07: 0 commits2026-03-08: 0 commits2026-03-09: 0 commits2026-03-10: 0 commits2026-03-11: 0 commits2026-03-12: 0 commits2026-03-13: 0 commits2026-03-14: 0 commits2026-03-15: 0 commits2026-03-16: 0 commits2026-03-17: 0 commits2026-03-18: 0 commits2026-03-19: 0 commits2026-03-20: 0 commits2026-03-21: 0 commits2026-03-22: 0 commits2026-03-23: 0 commits2026-03-24: 0 commits2026-03-25: 0 commits2026-03-26: 0 commits2026-03-27: 0 commits2026-03-28: 0 commits2026-03-29: 0 commits2026-03-30: 0 commits2026-03-31: 0 commits2026-04-01: 0 commits2026-04-02: 0 commits2026-04-03: 0 commits2026-04-04: 0 commits2026-04-05: 0 commits2026-04-06: 0 commits2026-04-07: 0 commits2026-04-08: 0 commits2026-04-09: 0 commits2026-04-10: 0 commits2026-04-11: 0 commits2026-04-12: 0 commits2026-04-13: 0 commits2026-04-14: 0 commits2026-04-15: 0 commits2026-04-16: 0 commits2026-04-17: 0 commits2026-04-18: 0 commits2026-04-19: 0 commits2026-04-20: 0 commits2026-04-21: 0 commits2026-04-22: 0 commits2026-04-23: 0 commits2026-04-24: 0 commits2026-04-25: 0 commits2026-04-26: 0 commits2026-04-27: 0 commits2026-04-28: 0 commits2026-04-29: 0 commits2026-04-30: 0 commits2026-05-01: 0 commits2026-05-02: 0 commits2026-05-03: 0 commits2026-05-04: 0 commits2026-05-05: 0 commits2026-05-06: 0 commits2026-05-07: 0 commits2026-05-08: 0 commits2026-05-09: 0 commits2026-05-10: 0 commits2026-05-11: 0 commits2026-05-12: 0 commits2026-05-13: 0 commits2026-05-14: 0 commits2026-05-15: 0 commits2026-05-16: 0 commits2026-05-17: 0 commits2026-05-18: 0 commits2026-05-19: 0 commits2026-05-20: 0 commits2026-05-21: 0 commits2026-05-22: 0 commits2026-05-23: 0 commits2026-05-24: 0 commits2026-05-25: 0 commits2026-05-26: 0 commits2026-05-27: 0 commits2026-05-28: 0 commits2026-05-29: 0 commits2026-05-30: 0 commits2026-05-31: 0 commits2026-06-01: 0 commits2026-06-02: 0 commits2026-06-03: 0 commits2026-06-04: 0 commits2026-06-05: 0 commits2026-06-06: 0 commits2026-06-07: 0 commits2026-06-08: 0 commits2026-06-09: 0 commits2026-06-10: 0 commits2026-06-11: 0 commits2026-06-12: 0 commits2026-06-13: 0 commits2026-06-14: 0 commits2026-06-15: 0 commits2026-06-16: 0 commits2026-06-17: 0 commits2026-06-18: 0 commits2026-06-19: 0 commits2026-06-20: 0 commits2026-06-21: 0 commits2026-06-22: 0 commits2026-06-23: 0 commits2026-06-24: 0 commits2026-06-25: 0 commits2026-06-26: 0 commits2026-06-27: 0 commits2026-06-28: 0 commits2026-06-29: 0 commits2026-06-30: 0 commits2026-07-01: 0 commits2026-07-02: 0 commits2026-07-03: 0 commits2026-07-04: 0 commits2026-07-05: 0 commits2026-07-06: 0 commits2026-07-07: 0 commits2026-07-08: 0 commits2026-07-09: 0 commits2026-07-10: 0 commits2026-07-11: 0 commits2026-07-12: 0 commits2026-07-13: 0 commits2026-07-14: 0 commits2026-07-15: 0 commits2026-07-16: 0 commits2026-07-17: 0 commits2026-07-18: 0 commits2026-07-19: 0 commits2026-07-20: 0 commits2026-07-21: 0 commits2026-07-22: 0 commits2026-07-23: 0 commits2026-07-24: 0 commits2026-07-25: 0 commits2026-07-26: 0 commits2026-07-27: 0 commits2026-07-28: 0 commits2026-07-29: 0 commits2026-07-30: 0 commits2026-07-31: 0 commits2026-08-01: 0 commits2026-08-02: 0 commits2026-08-03: 0 commits2026-08-04: 0 commits2026-08-05: 0 commits2026-08-06: 0 commits2026-08-07: 0 commits2026-08-08: 0 commits2026-08-09: 0 commits2026-08-10: 0 commits2026-08-11: 0 commits2026-08-12: 0 commits2026-08-13: 0 commits2026-08-14: 0 commits2026-08-15: 0 commits2026-08-16: 0 commits2026-08-17: 0 commits2026-08-18: 0 commits2026-08-19: 0 commits2026-08-20: 0 commits2026-08-21: 0 commits2026-08-22: 0 commits2026-08-23: 0 commits2026-08-24: 0 commits2026-08-25: 0 commits2026-08-26: 0 commits2026-08-27: 0 commits2026-08-28: 0 commits2026-08-29: 0 commits2026-08-30: 0 commits2026-08-31: 0 commits2026-09-01: 0 commits2026-09-02: 0 commits2026-09-03: 0 commits2026-09-04: 0 commits2026-09-05: 0 commits2026-09-06: 0 commits2026-09-07: 0 commits2026-09-08: 0 commits2026-09-09: 0 commits2026-09-10: 0 commits2026-09-11: 0 commits2026-09-12: 0 commits2026-09-13: 0 commits2026-09-14: 0 commits2026-09-15: 1 commit2026-09-16: 0 commits2026-09-17: 0 commits2026-09-18: 0 commits2026-09-19: 0 commits2026-09-20: 0 commits2026-09-21: 0 commits2026-09-22: 0 commits2026-09-23: 0 commits2026-09-24: 0 commits2026-09-25: 0 commits2026-09-26: 0 commits2026-09-27: 0 commits2026-09-28: 0 commits2026-09-29: 0 commits2026-09-30: 0 commits2026-10-01: 0 commits2026-10-02: 0 commits2026-10-03: 0 commits2026-10-04: 0 commits2026-10-05: 0 commits2026-10-06: 0 commits2026-10-07: 0 commits2026-10-08: 0 commits2026-10-09: 0 commits2026-10-10: 0 commits2026-10-11: 0 commits2026-10-12: 0 commits2026-10-13: 0 commits2026-10-14: 0 commits2026-10-15: 0 commits2026-10-16: 0 commits2026-10-17: 0 commits2026-10-18: 0 commits2026-10-19: 1 commit2026-10-20: 0 commits2026-10-21: 0 commits2026-10-22: 1 commit2026-10-23: 0 commits2026-10-24: 0 commits2026-10-25: 0 commits2026-10-26: 0 commits2026-10-27: 0 commits2026-10-28: 0 commits2026-10-29: 0 commits2026-10-30: 0 commits2026-10-31: 0 commits2026-11-01: 0 commits2026-11-02: 0 commits2026-11-03: 0 commits2026-11-04: 0 commits2026-11-05: 0 commits2026-11-06: 0 commits2026-11-07: 0 commits2026-11-08: 0 commits2026-11-09: 0 commits2026-11-10: 0 commits2026-11-11: 0 commits2026-11-12: 0 commits2026-11-13: 0 commits2026-11-14: 0 commits2026-11-15: 0 commits2026-11-16: 0 commits2026-11-17: 1 commit2026-11-18: 0 commits2026-11-19: 0 commits2026-11-20: 0 commits2026-11-21: 0 commits
4 commits in the last yearLessMore

What pgrust does

pgrust is an ambitious ground-up rewrite of PostgreSQL 18.3 in Rust, prioritizing execution speed and demonstrating what Postgres would look like if built today. It achieves full wire and SQL dialect compatibility, passing all 46,066 official Postgres regression tests to ensure strict behavioral parity with the original C implementation. The project leverages Rust's safety to introduce a new vectorized push-based JIT compiled executor, a thread-based concurrency model, and a custom query scheduler. These architectural changes allow it to outperform both standard Postgres and ClickHouse on specific analytics benchmarks when tuned for Graviton4 processors.

Database engineers, backend developers, and performance researchers looking for a highly optimized, memory-safe alternative to standard PostgreSQL. Familiarity with ai-assisted-development workflows is highly recommended for optimal usage.

  • Strict regression parity: Validates absolute correctness by passing 100% of the 46,066 tests in the official PostgreSQL 18.3 regression suite.
  • Vectorized JIT executor: Replaces the traditional Postgres executor with a new vectorized, push-based, JIT compiled engine tuned for Graviton4.
  • Thread-based concurrency: Uses a modern thread-based concurrency model to vastly improve throughput compared to standard Postgres process forks.
  • Built-in OOM killer: Includes a custom Out-Of-Memory killer that provides graceful degradation rather than allowing the OS to kill the entire database.
  • Formal verification: Utilizes Kani to formally verify that over 1,000 user-facing functions have identical behavior to the original C implementation.

Where teams use it

High-Throughput Analytics

Teams can replace standard Postgres deployments with pgrust to handle massive concurrent read loads faster than ClickHouse.

Database Engine Research

Developers can safely experiment with new indexing, batching, or operator fusion strategies without fighting legacy C macros.

Performance Upgrades

Organizations can point pgrust at their existing data directories for an immediate performance boost on read-heavy workloads.

Reliability Engineering

Use the built-in OOM killer and advanced scheduler to prevent runaway queries from crashing the entire database cluster.

Getting started: initdb -D /tmp/pgrust-data --no-locale --encoding UTF8 -U postgres

README

main branch

pgrust

A Postgres-compatible database, rewritten in Rust, built for fast analytics on your Postgres data.

Postgres 18.6 Version: v0.4-beta License: AGPL-3.0

Try pgrust in your browser →   |   Discord   |   Updates   |   Issues

New: Video of Michael's talk at PlanetScale on pgrust — and the slides.

How AI Changes the Economics of JIT Compilers

v0.4-beta is out: the release post and what's new.

pgrust is a drop-in replacement for Postgres built for fast analytics. It is wire compatible and SQL dialect compatible with Postgres 18, so your existing drivers, ORMs, psql and tools work unchanged. It is Postgres rebuilt the way it would be built in 2026.

Every line is Rust, written to match the behavior of the C implementation. Rust makes it easy to re-architect several core Postgres pieces. pgrust has:

  • Gravity, a new vectorized push-based, JIT compiled query engine
  • A thread based concurrency model
  • A query scheduler designed to keep any individual query from taking down your database
  • An automatic memory manager: one memory budget, sized from the machine, covers the buffer pool, the columnar caches and running queries, and gives pgrust control of what happens when you're running low on memory, greatly reducing the chance of your whole DB being taken down by the OS OOM killer

and many other really awesome pieces. The scheduler and the memory manager go after two of the four horsemen behind thousands of Postgres outages.

Quickstart

In your browser: https://pgrust.com, a full pgrust server compiled to WebAssembly, no install.

On your machine: download a release tarball from https://pgrust.com/downloads/v0.4-beta/. Each one is self-contained: it carries pgrust's own bin/postgres, bin/initdb and bin/psql plus the share files they read, so you do not need a PostgreSQL install. The Linux binaries need glibc 2.34 or newer (Debian 12, Ubuntu 22.04, RHEL/Rocky 9 and later); the macOS binaries need macOS 11 or newer.

Tarball Runs on
pgrust-0.4-beta-linux-x86_64.tar.gz any x86-64 CPU
pgrust-0.4-beta-linux-aarch64.tar.gz any 64-bit Arm CPU
pgrust-0.4-beta-linux-x86_64-znver3.tar.gz tuned for AMD Zen 3 and newer
pgrust-0.4-beta-linux-aarch64-neoverse-v2.tar.gz tuned for Neoverse-V2 (AWS Graviton4, NVIDIA Grace)
pgrust-0.4-beta-macos-arm64.tar.gz macOS on Apple Silicon
pgrust-0.4-beta-macos-x86_64.tar.gz macOS on Intel
pgrust-0.4-beta-macos-universal.tar.gz macOS, either (both architectures in one binary)

The Linux builds are profile-guided optimized. The tuned builds use instructions only those CPUs (and newer ones) have; when in doubt, take the generic build. Every tarball has a .sha256 file next to it, and MANIFEST.txt lists them all.

Linux

# Pick your build: linux-x86_64, linux-aarch64, linux-x86_64-znver3 or
# linux-aarch64-neoverse-v2 (see the table above).
PLATFORM=linux-x86_64

# Download pgrust, verify the checksum and unpack it.
curl -LO "https://pgrust.com/downloads/v0.4-beta/pgrust-0.4-beta-$PLATFORM.tar.gz"
curl -LO "https://pgrust.com/downloads/v0.4-beta/pgrust-0.4-beta-$PLATFORM.tar.gz.sha256"
sha256sum -c "pgrust-0.4-beta-$PLATFORM.tar.gz.sha256"
tar xzf "pgrust-0.4-beta-$PLATFORM.tar.gz"
cd pgrust-0.4-beta-linux-*/

# Create a data directory with pgrust's initdb.
bin/initdb -D /tmp/pgrust-data --no-locale --encoding UTF8 -U postgres

# Start the server. It runs in the foreground and logs to this terminal.
ulimit -s 65520
RUST_MIN_STACK=33554432 bin/postgres \
  -D /tmp/pgrust-data \
  -k /tmp -p 5432 \
  -c listen_addresses= \
  -c io_method=sync \
  -c max_stack_depth=60000

Leave the server running and connect from a second terminal, in the same directory:

bin/psql -h /tmp -p 5432 -U postgres -c "select version()"

You should see PostgreSQL 18.6 (pgrust 0.4-beta, build <commit>) on ..., where <commit> is the short commit the binary was built from. bin/postgres --version prints pgrust 0.4-beta (PostgreSQL 18.6 compatible).

Docker

The prebuilt image on Docker Hub, malisper/pgrust, is a drop-in replacement for the official postgres image: same env vars (POSTGRES_PASSWORD, POSTGRES_USER, POSTGRES_DB, PGDATA, ...), same /docker-entrypoint-initdb.d init scripts, same data volume at /var/lib/postgresql/data. It carries the same postgres and initdb binaries as the Linux release tarballs above, and initializes the cluster with pgrust's own initdb; the only C PostgreSQL component in the image is psql for the init scripts. malisper/pgrust:v0.4-beta is multi-arch (amd64 + arm64); v0.4-beta-amd64 and v0.4-beta-arm64 pin one architecture.

docker run -d --name pgrust -e POSTGRES_PASSWORD=secret -p 5432:5432 malisper/pgrust:v0.4-beta

Then connect, with your own psql or the one in the image:

psql -h localhost -p 5432 -U postgres
docker exec -it pgrust psql -U postgres

malisper/pgrust:latest still points at v0.3; use the v0.4-beta tag to get this release. A data volume written by v0.3 holding columnar tables needs the dump and restore described under Stopping, restarting, cleaning up.

macOS

# Pick your build: macos-arm64 (Apple Silicon), macos-x86_64 (Intel) or
# macos-universal (both).
PLATFORM=macos-arm64

# Download pgrust, verify the checksum and unpack it. Download with curl: curl
# does not set the quarantine flag a browser download gets, so Gatekeeper stays
# out of the way (see the note below).
curl -LO "https://pgrust.com/downloads/v0.4-beta/pgrust-0.4-beta-$PLATFORM.tar.gz"
curl -LO "https://pgrust.com/downloads/v0.4-beta/pgrust-0.4-beta-$PLATFORM.tar.gz.sha256"
shasum -a 256 -c "pgrust-0.4-beta-$PLATFORM.tar.gz.sha256"
tar xzf "pgrust-0.4-beta-$PLATFORM.tar.gz"
cd "pgrust-0.4-beta-$PLATFORM"

# Create a data directory with pgrust's initdb.
bin/initdb -D /tmp/pgrust-data --no-locale --encoding UTF8 -U postgres

# Start the server. It runs in the foreground and logs to this terminal.
ulimit -s 65520
RUST_MIN_STACK=33554432 bin/postgres \
  -D /tmp/pgrust-data \
  -k /tmp -p 5432 \
  -c listen_addresses= \
  -c io_method=sync \
  -c max_stack_depth=60000

Leave the server running and connect from a second terminal, in the same directory:

bin/psql -h /tmp -p 5432 -U postgres -c "select version()"

A note on Gatekeeper: the macOS binaries are signed ad hoc, not notarized by Apple. Downloaded with curl as above, they are never quarantined and none of this comes up. If you download with a browser instead, macOS refuses to run them with "Apple could not verify ... is free of malware". Clear the flag with xattr -dr com.apple.quarantine pgrust-0.4-beta-$PLATFORM, or approve each binary under System Settings > Privacy & Security > "Open Anyway".

Columnar tables

Columnar storage (pgrcolumnar) is a table access method. Register it once in each database, then create tables with USING pgrcolumnar:

CREATE ACCESS METHOD pgrcolumnar TYPE TABLE HANDLER heap_tableam_handler;

CREATE TABLE events (id bigint, kind text, val double precision, at timestamp)
  USING pgrcolumnar;

Stopping, restarting, cleaning up

  • Stop the server with Ctrl-C in its terminal, or kill -INT <pid>. That is Postgres' fast shutdown and it is safe.
  • Start it again by rerunning the same server command with the same data directory. Your data is preserved across restarts.
  • Start over by deleting the data directory: rm -rf /tmp/pgrust-data. This deletes all data in it.
  • If startup fails with FATAL: lock file "/tmp/.s.PGSQL.5432.lock" already exists, another server, most likely an existing Postgres install, is already using port 5432. Start pgrust on a different port with -p 5433 and connect with psql -h /tmp -p 5433 -U postgres. Whenever a regular Postgres is running on the same machine, check select version() after connecting; it is easy to silently connect to the wrong server and wonder why nothing behaves like pgrust.
  • If startup fails with could not open directory "/usr/local/pgsql/share/timezone", the server cannot find its share files. It reads them from the share directory beside the binary, so run bin/postgres from the unpacked tarball as is, without moving the binary away from bin/share. PGRUST_PGSHAREDIR and PGRUST_TZDIR point it elsewhere.
  • Columnar tables from v0.3 (USING pgrcolumnar) are refused with an error saying the table is in the v0.3.x columnar format. Dump them with the v0.3 binary (pg_dump) and restore them into v0.4-beta.

When to use pgrust

  • Analytics on your Postgres data without a separate warehouse. Put large tables in pgrcolumnar and query them with the same SQL, in the same database as your application data.
  • Speeding up slow Postgres queries with large scans, joins and aggregations, such as dashboards and reporting.
  • One database for transactions and analytics, instead of Postgres plus ClickHouse or a warehouse kept in sync by a pipeline.

Status

We're working with a few early design partners and are targeting production readiness in Q1 2027. Testing and reliability are our top priority; see Testing for how we verify pgrust against Postgres. We run pgrust ourselves internally today.

Extensions

pgrust ships the most-used Postgres extensions built in: pgvector, pg_cron, pg_stat_statements, pg_trgm, hstore, pgcrypto, postgres_fdw and most of contrib. Install them with CREATE EXTENSION as usual.

pgrust doesn't load C extension binaries compiled for Postgres, but porting an existing extension to pgrust is straightforward, and we add new ones regularly. If you need an extension that isn't listed, open an issue and we'll prioritize it. PL/Python, PL/Perl and PL/Tcl are not supported yet.

Performance

Measured on c8g.4xlarge (AWS Graviton4), pgrust with pgrcolumnar, its builtin columnar layout, runs ClickBench's analytical queries up to 1,600x faster than PostgreSQL (per query, cold runs, against PostgreSQL's published results on the same instance type).

For a code-level walkthrough of one part of that speedup, read how batching, operator fusion, and SIMD speed up the query engine.

Writing

Testing

The most common question we get about pgrust is: how can anyone trust it? Passing a test suite doesn't mean our code is correct. Getting to the point where people can trust pgrust is our number one priority today.

To achieve that goal, we're taking several different approaches:

  1. Of the 3,400 user facing Postgres functions, we've formally verified that 1,397 have identical behavior in pgrust with Kani; 466 more are tested against Postgres. The ledger is proofs/USER_FACING_FUNCTIONS.tsv.
  2. We're engaging with Antithesis to do simulation testing of pgrust to battle test pgrust.
  3. We're doing aggressive differential fuzz testing to ensure pgrust's behavior is identical to Postgres's.

Unsafe Code

pgrust uses unsafe code, but only for the specific things that need it. Postgres represents every internal value as a Datum, an untyped 8 byte value, and Rust has no safe equivalent, so the code that packs and unpacks internal values is unsafe. The same goes for the places where pgrust must match Postgres' memory layouts byte for byte.

If there are particular unsafes that are not necessary and removing them would not have an impact on performance, let us know, as we would love to remove more unsafes.

Building from source

You need the Rust toolchain (any rustup install works; rust-toolchain.toml pins the build to Rust 1.96.0 and rustup fetches it automatically) and the RE2 regex library:

  • Debian/Ubuntu: sudo apt-get install -y build-essential pkg-config libre2-dev
  • macOS: brew install re2 pkg-config
cargo build --release --locked -p main_main -p initdb

select version() names the build: a build in a git checkout prints its short commit (PostgreSQL 18.6 (pgrust 0.4-beta, build 1a2b3c4) on ...); set PGRUST_BUILD_ID at build time to choose the id, or build outside git for none. postgres --version prints pgrust 0.4-beta (PostgreSQL 18.6 compatible); postgres -V prints postgres (PostgreSQL) 18.6, the line PostgreSQL's own pg_ctl, initdb and pg_upgrade check.

The server binary lands at target/release/postgres, pgrust's initdb beside it, and the share tree it needs (postgres.bki, the setup SQL, timezone, timezonesets, tsearch data, extension files) is staged at target/release/share/. No C PostgreSQL is involved in creating or running a cluster:

target/release/initdb -D /tmp/pgrust-data --no-locale --encoding UTF8 -U postgres
ulimit -s 65520
RUST_MIN_STACK=33554432 target/release/postgres -D /tmp/pgrust-data \
  -k /tmp -p 5432 -c listen_addresses= -c io_method=sync -c max_stack_depth=60000

The time zone database is PostgreSQL 18.6's own compiled tzdata, read from share/timezone beside the binary (never the host zoneinfo, like C built without --with-system-tzdata). To use the system zoneinfo instead, build with PGRUST_SYSTEM_TZDATA=/usr/share/zoneinfo (C's --with-system-tzdata); PGRUST_TZDIR and PGRUST_PGSHAREDIR remain runtime overrides, not requirements. A data directory made by stock PostgreSQL 18 initdb still works too (same on-disk format). Release builds refuse to compile without RE2 on purpose: a build with only the fallback regex engine is drastically slower on regex heavy workloads. The binaries we publish additionally use --profile dist, which turns on fat LTO; it produces a faster binary but takes much longer to compile.

What's new in v0.4-beta

  • Gravity, a new query engine. Gravity runs every query and every kind of statement (DML with ON CONFLICT and RETURNING, triggers, row locks, cursors, PL/pgSQL and SPI, COPY) with PostgreSQL's semantics, on columnar tables and on the ordinary row store alike. It replaces our previous engine and runs analytical queries as much as 3x faster than ClickHouse. Its JIT was rewritten around a new low-level IR: it compiles each plan to AArch64 or x86-64 machine code, and to WebAssembly in the browser build, or interprets it when compiling would not pay off.
  • pgrcolumnar grows up. pgrcolumnar stores compressed, immutable parts with zone maps, delete vectors and background compaction. Reads see PostgreSQL MVCC snapshots, and writes are transactional: they roll back with the transaction. Small inserts land in a row-store front that is folded into columnar parts in the background, and UPDATE and DELETE mark rows in delete vectors instead of rewriting parts (ON CONFLICT and MERGE are not supported on columnar tables yet). Columnar tables take non-unique B-tree, hash, GiST, SP-GiST and GIN indexes, are written to WAL, so they survive crashes and replicate to standbys, and support row locks and a sorted_by table option.
  • One memory budget covers the buffer pool, the columnar caches and running queries. Near the memory limit pgrust cancels the statement holding the most memory instead of letting the OS kill the server.
  • jsonb statistics. ANALYZE collects statistics on the keys and values inside jsonb columns, and the planner uses them for ->, ->>, #>, #>> and ?, ?|, ?&, so it estimates jsonb filters instead of guessing. On by default (pgrust.jsonb_path_stats).
  • The condition cache. Filter results on columnar tables are reused across statements over the same immutable data. full is the default (also spelled on) and stores match counts too. rows keeps row selections and per-dictionary-code filter tables without counts; granule keeps only empty-granule verdicts; off disables predicate reuse. pgrust.dict_filter_cache and pgrust.zone_store turn off the per-dictionary-code filter tables and the zone-map result store on their own. Sizing feedback, data caches, and startup prewarm have separate controls.
  • pgrust's own initdb, and pg_cron 1.6 is included.
  • Upgrading: columnar tables from v0.3 must be dumped and restored. UTF8 is the only server encoding.

v0.4-beta is a beta: it shows what is coming in v0.4 while we finish stabilizing the rest.

Developing in the open

Up to v0.3 we developed pgrust privately and published it in large monthly releases. Starting with v0.4-beta, development happens in this repository: features, optimizations and bug fixes are pushed here as soon as they are ready, instead of being held back for the next release.

Implementation

Executor

  • Gravity, a vectorized, push-based executor that compiles plans to machine code (AArch64 and x86-64) with a JIT that emits code directly.

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, WAL-logged.
  • 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.

Other

  • The automatic memory manager. Near the machine's memory limit, pgrust cancels the statement holding the most memory, so that one query dies and the server itself can keep running.

Roadmap

Next we're working on testing and battle testing pgrust and making it so people can trust pgrust with their data.

Beyond that we want to add:

  • Instant forking
  • Autoscaling including scale to zero
  • Planner support for JSON
  • Undo log support for a no-vacuum design
  • Adaptive planner to prevent bad plans
  • A mini version of pgrust designed for testing and being embedded

Contributing

We are not actively accepting pull requests right now. If you want to help out with the project, reach out on Discord.

Please do still open an issue if something breaks, if setup is confusing, or if there is a Postgres behavior you want matched.

License

pgrust is licensed under AGPL-3.0. Portions derived from PostgreSQL remain under the PostgreSQL License. The JIT's code generator (crates/tpde/) is ported from TPDE (Apache-2.0 WITH LLVM-exception) and Fadec and Disarm (BSD-3-Clause). See NOTICE.

Acknowledgements: the research and other systems whose ideas pgrust uses are credited in ACKNOWLEDGEMENTS.md.

Contact

View on GitHub

Recent activity

commits and pull requests

Releases and announcements

4 total
  1. pgrust v0.4-betav0.4-betaOct 22, 2026

    pgrust v0.4-beta is a beta: it shows what is coming in v0.4 while we finish stabilizing the rest. Read the release post: https://pgrust.com/blog/pgrust-v0-4-beta/ ## What's new - **Gravity, a new query engine.** Gravity runs every query and every kind of statement (DML with ON CONFLICT and RETURNING, triggers, row locks, cursors, PL/pgSQL and SPI, COPY) with PostgreSQL's semantics, on columnar tables and on the ordinary row store alike. It replaces our previous engine and runs analytical queries as much as 3x faster than ClickHouse. Its JIT compiles each plan to AArch64 or x86-64 machine code, and to WebAssembly in the browser build. - **pgrcolumnar grows up.** MVCC snapshots, transactional writes, a row-store front for small inserts, UPDATE and DELETE through delete vectors, background compaction, WAL logging (crash safety and replication), non-unique B-tree, hash, GiST, SP-GiST and GIN indexes, row locks, and a `sorted_by` table option. - **Automatic memory management.** One memory budget covers the buffer pool, the columnar caches and running queries. Near the memory limit pgrust cancels the statement holding the most memory instead of letting the OS kill the server. - **jsonb

  2. v0.3.1v0.3.1Oct 19, 2026

    # pgrust v0.3.1 v0.3.1 is a bug-fix release on top of v0.3, still compatible with Postgres 18.6. ## Fixes - Fix whole-row record references while preserving fields literally named `"*"`. - Fix duplicated COPY notice context. - Decode only the requested prefix for LZ4-compressed TOAST slices. - Fix BRIN indexes with custom operator classes to use their own support functions instead of the built-in ones. - Fix integer percentile ordering and transaction statistics accounting. ## Upgrade Rebuild existing BRIN indexes that use custom operator classes with `REINDEX`. pgrust is still experimental and not for production.

  3. Releasing pgrust v0.3, our Postgres rewrite from C to Rust. This release is mostly about making pgrust more reliable. Try it on real world workloads in non-critical environments. pgrust is not production ready. Do not put data you care about in it. If it behaves differently from Postgres, please [open an issue](https://github.com/malisper/pgrust/issues) with a reproduction. ## What's new in v0.3 - We're now on PostgreSQL 18.6, including its bug and security fixes. - `cbstore` is now `pgrcolumnar`. Update SQL that uses `USING cbstore` to `USING pgrcolumnar`; the old name no longer works. - `version()` now reads `PostgreSQL 18.6 (pgrust 0.3)`. See the [README](https://github.com/malisper/pgrust/blob/main/README.md) for setup, and the [full commit history](https://github.com/malisper/pgrust/commits/v0.3) behind this release. ## Downloads Single static binary; run it in place of `postgres`. | Platform | Download | SHA-256 | |---|---|---| | macOS (Apple Silicon) | [pgrust-0.3-macos-arm64](https://pgrust.com/downloads/v0.3/pgrust-0.3-macos-arm64) | `edcb7cb72b88cae26b0fc3325c540051a159ae1f1fd5e2e5dfe42eb7eb16aa81` | | macOS (Intel) | [pgrust-0.3-macos-x86_64](https://pgrust.com/do

  4. 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 unc

Code frequency

additions and deletions
+10.4M-10.4MWeek of 2026-09-13: +10,418,571 linesWeek of 2026-09-13: -0 linesWeek of 2026-09-20: +0 linesWeek of 2026-09-20: -0 linesWeek of 2026-09-27: +0 linesWeek of 2026-09-27: -0 linesWeek of 2026-10-04: +0 linesWeek of 2026-10-04: -0 linesWeek of 2026-10-11: +0 linesWeek of 2026-10-11: -0 linesWeek of 2026-10-18: +3,051,607 linesWeek of 2026-10-18: -3,518,098 linesWeek of 2026-10-25: +0 linesWeek of 2026-10-25: -0 linesWeek of 2026-11-01: +0 linesWeek of 2026-11-01: -0 linesWeek of 2026-11-08: +0 linesWeek of 2026-11-08: -0 linesWeek of 2026-11-15: +28 linesWeek of 2026-11-15: -15 linesSep 13, 2026Nov 15, 2026
+13.5M lines added, -3.5M removed over the last year.

Commits per week

last 52 weeks
20Week of 2025-11-23: 0 commitsWeek of 2025-11-30: 0 commitsWeek of 2025-12-07: 0 commitsWeek of 2025-12-14: 0 commitsWeek of 2025-12-21: 0 commitsWeek of 2025-12-28: 0 commitsWeek of 2026-01-04: 0 commitsWeek of 2026-01-11: 0 commitsWeek of 2026-01-18: 0 commitsWeek of 2026-01-25: 0 commitsWeek of 2026-02-01: 0 commitsWeek of 2026-02-08: 0 commitsWeek of 2026-02-15: 0 commitsWeek of 2026-02-22: 0 commitsWeek of 2026-03-01: 0 commitsWeek of 2026-03-08: 0 commitsWeek of 2026-03-15: 0 commitsWeek of 2026-03-22: 0 commitsWeek of 2026-03-29: 0 commitsWeek of 2026-04-05: 0 commitsWeek of 2026-04-12: 0 commitsWeek of 2026-04-19: 0 commitsWeek of 2026-04-26: 0 commitsWeek of 2026-05-03: 0 commitsWeek of 2026-05-10: 0 commitsWeek of 2026-05-17: 0 commitsWeek of 2026-05-24: 0 commitsWeek of 2026-05-31: 0 commitsWeek of 2026-06-07: 0 commitsWeek of 2026-06-14: 0 commitsWeek of 2026-06-21: 0 commitsWeek of 2026-06-28: 0 commitsWeek of 2026-07-05: 0 commitsWeek of 2026-07-12: 0 commitsWeek of 2026-07-19: 0 commitsWeek of 2026-07-26: 0 commitsWeek of 2026-08-02: 0 commitsWeek of 2026-08-09: 0 commitsWeek of 2026-08-16: 0 commitsWeek of 2026-08-23: 0 commitsWeek of 2026-08-30: 0 commitsWeek of 2026-09-06: 0 commitsWeek of 2026-09-13: 1 commitsWeek of 2026-09-20: 0 commitsWeek of 2026-09-27: 0 commitsWeek of 2026-10-04: 0 commitsWeek of 2026-10-11: 0 commitsWeek of 2026-10-18: 2 commitsWeek of 2026-10-25: 0 commitsWeek of 2026-11-01: 0 commitsWeek of 2026-11-08: 0 commitsWeek of 2026-11-15: 1 commitsNov 23, 2025Nov 15, 2026
4 commits in the last 52 weeks.

When work happens

weekday and hour
SunMonTueWedThuFriSat036912151821Sun 0:00 — 0 commitsSun 1:00 — 0 commitsSun 2:00 — 0 commitsSun 3:00 — 0 commitsSun 4:00 — 0 commitsSun 5:00 — 0 commitsSun 6:00 — 0 commitsSun 7:00 — 0 commitsSun 8:00 — 0 commitsSun 9:00 — 0 commitsSun 10:00 — 0 commitsSun 11:00 — 0 commitsSun 12:00 — 0 commitsSun 13:00 — 0 commitsSun 14:00 — 0 commitsSun 15:00 — 0 commitsSun 16:00 — 0 commitsSun 17:00 — 0 commitsSun 18:00 — 0 commitsSun 19:00 — 0 commitsSun 20:00 — 0 commitsSun 21:00 — 0 commitsSun 22:00 — 0 commitsSun 23:00 — 0 commitsMon 0:00 — 0 commitsMon 1:00 — 0 commitsMon 2:00 — 0 commitsMon 3:00 — 0 commitsMon 4:00 — 0 commitsMon 5:00 — 0 commitsMon 6:00 — 0 commitsMon 7:00 — 0 commitsMon 8:00 — 0 commitsMon 9:00 — 0 commitsMon 10:00 — 0 commitsMon 11:00 — 0 commitsMon 12:00 — 0 commitsMon 13:00 — 0 commitsMon 14:00 — 0 commitsMon 15:00 — 0 commitsMon 16:00 — 1 commitsMon 17:00 — 0 commitsMon 18:00 — 0 commitsMon 19:00 — 0 commitsMon 20:00 — 0 commitsMon 21:00 — 0 commitsMon 22:00 — 0 commitsMon 23:00 — 0 commitsTue 0:00 — 0 commitsTue 1:00 — 0 commitsTue 2:00 — 0 commitsTue 3:00 — 0 commitsTue 4:00 — 0 commitsTue 5:00 — 0 commitsTue 6:00 — 0 commitsTue 7:00 — 0 commitsTue 8:00 — 0 commitsTue 9:00 — 0 commitsTue 10:00 — 1 commitsTue 11:00 — 0 commitsTue 12:00 — 0 commitsTue 13:00 — 0 commitsTue 14:00 — 0 commitsTue 15:00 — 0 commitsTue 16:00 — 0 commitsTue 17:00 — 0 commitsTue 18:00 — 0 commitsTue 19:00 — 0 commitsTue 20:00 — 0 commitsTue 21:00 — 1 commitsTue 22:00 — 0 commitsTue 23:00 — 0 commitsWed 0:00 — 0 commitsWed 1:00 — 0 commitsWed 2:00 — 0 commitsWed 3:00 — 0 commitsWed 4:00 — 0 commitsWed 5:00 — 0 commitsWed 6:00 — 0 commitsWed 7:00 — 0 commitsWed 8:00 — 0 commitsWed 9:00 — 0 commitsWed 10:00 — 0 commitsWed 11:00 — 0 commitsWed 12:00 — 0 commitsWed 13:00 — 0 commitsWed 14:00 — 0 commitsWed 15:00 — 0 commitsWed 16:00 — 0 commitsWed 17:00 — 0 commitsWed 18:00 — 0 commitsWed 19:00 — 0 commitsWed 20:00 — 0 commitsWed 21:00 — 0 commitsWed 22:00 — 0 commitsWed 23:00 — 0 commitsThu 0:00 — 0 commitsThu 1:00 — 0 commitsThu 2:00 — 0 commitsThu 3:00 — 0 commitsThu 4:00 — 0 commitsThu 5:00 — 0 commitsThu 6:00 — 0 commitsThu 7:00 — 0 commitsThu 8:00 — 0 commitsThu 9:00 — 0 commitsThu 10:00 — 0 commitsThu 11:00 — 0 commitsThu 12:00 — 0 commitsThu 13:00 — 0 commitsThu 14:00 — 0 commitsThu 15:00 — 1 commitsThu 16:00 — 0 commitsThu 17:00 — 0 commitsThu 18:00 — 0 commitsThu 19:00 — 0 commitsThu 20:00 — 0 commitsThu 21:00 — 0 commitsThu 22:00 — 0 commitsThu 23:00 — 0 commitsFri 0:00 — 0 commitsFri 1:00 — 0 commitsFri 2:00 — 0 commitsFri 3:00 — 0 commitsFri 4:00 — 0 commitsFri 5:00 — 0 commitsFri 6:00 — 0 commitsFri 7:00 — 0 commitsFri 8:00 — 0 commitsFri 9:00 — 0 commitsFri 10:00 — 0 commitsFri 11:00 — 0 commitsFri 12:00 — 0 commitsFri 13:00 — 0 commitsFri 14:00 — 0 commitsFri 15:00 — 0 commitsFri 16:00 — 0 commitsFri 17:00 — 0 commitsFri 18:00 — 0 commitsFri 19:00 — 0 commitsFri 20:00 — 0 commitsFri 21:00 — 0 commitsFri 22:00 — 0 commitsFri 23:00 — 0 commitsSat 0:00 — 0 commitsSat 1:00 — 0 commitsSat 2:00 — 0 commitsSat 3:00 — 0 commitsSat 4:00 — 0 commitsSat 5:00 — 0 commitsSat 6:00 — 0 commitsSat 7:00 — 0 commitsSat 8:00 — 0 commitsSat 9:00 — 0 commitsSat 10:00 — 0 commitsSat 11:00 — 0 commitsSat 12:00 — 0 commitsSat 13:00 — 0 commitsSat 14:00 — 0 commitsSat 15:00 — 0 commitsSat 16:00 — 0 commitsSat 17:00 — 0 commitsSat 18:00 — 0 commitsSat 19:00 — 0 commitsSat 20:00 — 0 commitsSat 21:00 — 0 commitsSat 22:00 — 0 commitsSat 23:00 — 0 commits
Commit volume by weekday and hour (UTC). Larger dots mean more commits.

Who is committing

last 52 weeks
Maintainer commits4 (100%)
Community commits0 (0%)

4 commits in total over the last year.

DateListRankStars gained
Jul 11, 2026daily#13+3
  • morluto/rea

    Reverse engineer anything with agents, from app behavior down to native binaries.

    471.6K stars · TypeScript

  • ultraworkers/claw-code

    An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

    194.8K stars · Rust

  • farion1231/cc-switch

    A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

    156K stars · Rust

  • openai/codex

    Lightweight coding agent that runs in your terminal

    136K stars · Rust

  • rust-lang/rust

    Empowering everyone to build reliable and efficient software.

    122.3K stars · Rust

  • pbakaus/impeccable

    The design vocabulary for your coding agent. Steer with polish and bolder, review with critique and audit, catch AI slop before it ships.

    114.1K stars · Rust