pgrust: A Postgres Rewrite in Rust
Reach for pgrust if you're curious how a Postgres-compatible engine looks when it's written in Rust, want to poke at server internals in a memory-safe language, or like following AI-assisted rewrites of large C codebases. Skip it if you need a database to run anything real today: the README itself says it's not production-ready and not performance-optimized, and the eye-catching '100% of regression tests, 50% faster, 300x on analytics' numbers describe a version that isn't published yet.
A Rust Engine That Boots Your Postgres 18.3 Data
pgrust is a Rust rewrite of Postgres targeting compatibility with Postgres 18.3. It's disk compatible, able to start from an existing Postgres 18.3 data directory, and validates against Postgres's own regression tests โ the current build matches expected output across 46,000+ queries. A newer, unpublished version reportedly passes 100% of the suite with a thread-per-connection model. It's AGPL-3.0 and openly experimental.
Rewriting Postgres Means Fighting Decades of C
Changing Postgres from the inside is hard. The codebase is decades of C, the process-per-connection model and vacuum-based storage are baked deep, and experimenting with server internals means fighting a lot of legacy before you can test an idea. pgrust exists to make that easier: keep the behavior Postgres-shaped and the real Postgres tests as the judge, but move to Rust so deeper changes to threading, storage, and query handling are safer to attempt.
46,000+ Regression Queries as the Correctness Oracle
- โDisk compatible with Postgres 18.3 โ boots from an existing Postgres data directory, no dump and restore
- โUses the real Postgres regression suite as the correctness oracle; the available build matches expected output across 46,000+ queries
- โWritten in Rust and built with AI-assisted programming, per the maintainer
- โTry-before-you-build paths: a WebAssembly demo at pgrust.com and a Docker image (malisper/pgrust:v0.1)
- โShips the vendored Postgres 18.3 test files plus a scripts/run-regression runner so you can verify compatibility yourself
- โRoadmap items include multithreaded internals, built-in connection pooling, and no-vacuum storage experiments
Big Numbers From a Version That Isn't Published Yet
A from-scratch Postgres rewrite that runs the real Postgres regression suite and can boot an existing 18.3 data directory is an unusually concrete take on the 'rewrite it in Rust' idea, and the maintainer is public about using AI-assisted programming to get there. The README's claim of an upcoming version that passes 100% of regression tests, runs 50% faster on transactions, and is roughly 300x faster on analytical workloads (its own benchmark puts it about 2x slower than ClickHouse on clickbench) is the kind of number that gets people looking, even though that build isn't shipped.
Booting From an Existing Data Directory
After building, initialise a data directory with `target/release/postgres --initdb -D /tmp/pgrust-data -L "$PWD/vendor/postgres-18.3/share" --no-locale --encoding UTF8 -U postgres`, start the server binary, then connect with a Postgres 18 `psql`: `psql -h /tmp -p 5432 -U postgres -d postgres`. To check compatibility yourself, run the vendored regression tests with `PGRUST_BIN="$PWD/target/release/postgres" scripts/run-regression` (it needs a Postgres 18 `psql` on PATH). pgrust can also boot directly from an existing Postgres 18.3 data directory.
A Docker Image or a WASM Demo, No Build Needed
The quickest path is the Docker image โ no build required: `docker run -d --name pgrust -e POSTGRES_PASSWORD=secret malisper/pgrust:v0.1` and then connect with the bundled `psql` client, or open the WebAssembly demo at pgrust.com with nothing installed at all. To build from source you'll need Rust plus system libraries (on macOS: `brew install icu4c openssl@3 libpq`; on Debian/Ubuntu: `build-essential pkg-config libicu-dev libssl-dev libldap2-dev libpam0g-dev postgresql-client-18`), then `PGRUST_PGSHAREDIR="$PWD/vendor/postgres-18.3/share" cargo build --release --locked --bin postgres`.
Poking at Server Internals in a Memory-Safe Language
- โขExperimenting with Postgres server internals in a memory-safe language instead of C
- โขTrying a Postgres-compatible engine against your own existing 18.3 data directory
- โขFollowing how AI-assisted programming is applied to a large systems rewrite
- โขRunning the Postgres regression suite against an alternative implementation to see where it diverges
Compatibility Measured Against Real Postgres Output
- โUses the actual Postgres regression suite as the oracle, so 'compatible' means matching real Postgres output, not a self-graded test set
- โDisk compatibility means you can point it at an existing Postgres 18.3 data directory without a dump-and-restore
- โYou can try it in a browser (WASM) or via one Docker command before committing to a source build
- โRust brings memory safety to a class of code that in C has produced a long history of subtle bugs
Not Production-Ready, and AGPL-3.0 Copyleft
- โณThe README states plainly that pgrust is not production-ready and not performance-optimized yet
- โณThe headline 100%-pass, 50%-faster, and ~300x-analytics figures describe an unpublished version โ the code you can actually run today matches 46,000+ regression queries, not the full suite
- โณExisting extensions and procedural languages such as PL/Python, PL/Perl, and PL/Tcl aren't generally compatible yet
- โณAGPL-3.0 is strong copyleft that many companies avoid for server-side software, since network use can trigger source-sharing obligations
- โณAn AI-assisted rewrite of a database is inherently high-risk for subtle correctness bugs that a regression suite won't always catch
PostgreSQL, Neon, CockroachDB, and Materialize
For the Database-Curious, Not for Production Data
pgrust is for database-curious engineers, Rust systems programmers, and people who want to watch an AI-assisted rewrite of Postgres unfold โ anyone who values poking at internals over running a workload. If you need a database for anything real, or you can't take on AGPL-3.0, this isn't it yet; run stock PostgreSQL and follow pgrust's updates instead.
pgrust FAQ
pgrust is a Postgres rewrite in Rust that targets compatibility with Postgres 18.3. It's disk compatible with Postgres, can boot from an existing 18.3 data directory, and checks itself against the real Postgres regression tests. The maintainer built it with Rust plus AI-assisted programming.
No. The README says explicitly that pgrust is not production-ready and not performance-optimized yet. It's an experiment for exploring Postgres internals, not a drop-in database for real workloads.
Not in the version you can run today. The README says the currently available build matches expected output across more than 46,000 regression queries, while a newer, not-yet-published version is described as passing 100% of the suite. Treat the 100% figure as a claim about upcoming, unreleased code.
The README says pgrust is disk compatible with Postgres and can boot from an existing Postgres 18.3 data directory, so in principle you can point it at data created by real Postgres 18.3 โ though given the not-production-ready status, only do this with copies you don't mind losing.
pgrust is licensed under AGPL-3.0, a strong copyleft license. That matters for server software because offering it over a network can trigger obligations to share your source, which is why some companies avoid AGPL dependencies.
Related repositories
Want a second opinion on pgrust?
Ask an AI that can read this page โ one click and you get its take on pgrust.
