malisper

pgrust: Run a Rust Rewrite of PostgreSQL

pgrust is a Rust reimplementation of PostgreSQL that aims to preserve its wire protocol and SQL behavior while reworking execution, concurrency, and storage. It is for evaluation and experimentation today, not production data you cannot afford to lose.

Stars
5.2k
Forks
198
Stars, last 17 days
+124

Our take

Health score

40/100

How it is scored
Activity
44
Community
4
Issues
68
Pull requests
44

+124 stars in the last 17 days

  • Fewer contributors than 91% of the projects we track

Overview

pgrust is a Rust reimplementation of PostgreSQL, designed to match PostgreSQL's protocol and SQL behavior while exploring a different database architecture. It targets workloads where vectorized execution, JIT compilation, and columnar storage may improve query performance.

The project reports passing PostgreSQL's regression suite, but explicitly warns that it still has bugs and is not recommended for production. It is most useful for developers evaluating database implementation ideas or testing a PostgreSQL-compatible server with non-critical data.

Key Features

  • PostgreSQL wire protocol and SQL dialect compatibility.
  • Vectorized, push-based query execution with JIT compilation.
  • Thread-based connection handling and parallel query execution.
  • Query scheduling intended to limit interference from long-running queries.
  • Built-in OOM handling that can terminate a worker rather than let the operating system stop the database.
  • pgrcolumnar, a column-oriented storage format with compression options.
  • A browser-based version and downloadable binaries, alongside Docker usage.

Use Cases

  • Database developers can study how Rust and a redesigned executor change PostgreSQL's implementation tradeoffs.
  • Teams can run controlled benchmarks against PostgreSQL-compatible workloads, while checking the project's benchmark caveats and hardware tuning.
  • PostgreSQL users can test compatibility or evaluate pgrust with disposable, non-critical data before considering any broader adoption.
  • Contributors and researchers can investigate conformance, differential fuzz testing, and formal verification of database behavior.

Getting Started

For a quick trial, use the browser build at pgrust.com. For local use, the README provides platform-specific setup, binaries, and Docker instructions. To build from source:

cargo build --release --locked --bin postgres

See the repository README for prerequisites and run instructions.

Considerations

  • The maintainers do not recommend production use yet and advise keeping PostgreSQL as the source of truth for data that cannot be lost.
  • Passing the regression suite is not a guarantee of correctness; the project prioritizes testing and reliability and describes remaining bugs.
  • Existing PostgreSQL extensions do not work because pgrust has no stable extension ABI. Some bundled contrib modules are ported, but PL/Python, PL/Perl, and PL/Tcl are not.
  • The JIT compiler targets Graviton4, so similar performance is not expected on other platforms. Reported benchmark results use Graviton4-tuned builds and may not match generic downloads.
  • The project is licensed under AGPL-3.0. Review the license and the PostgreSQL License notice for derived portions before adopting it.

Found this useful?

Share it with someone who would like pgrust.