pgrust
Postgres rewritten in Rust, now faster than Postgres and Clickhouse
What is pgrust?
Postgres rewritten in Rust, now faster than Postgres and Clickhouse
Overview of pgrust
What it is
pgrust is a re-implementation of Postgres written entirely in Rust. It is wire compatible and SQL dialect compatible with Postgres, meaning existing PostgreSQL clients and queries work without changes. Every line of code is Rust, written to match the behavior of the original C implementation.
Key features
- Gravity: a vectorized, push-based, JIT compiled query engine
- A thread-based concurrency model
- A query scheduler designed to prevent any single query from taking down the database
- An automatic memory manager that uses one memory budget (sized from the machine) covering the buffer pool, columnar caches, and running queries, reducing the chance of OS OOM kills
- Columnar storage (pgrcolumnar) available as a table access method
- Self-contained release tarballs that include pgrust's own binaries and share files, no separate PostgreSQL install needed
Use cases
- Drop-in replacement for PostgreSQL in existing applications
- Analytical workloads using columnar storage
- Running in Docker as a replacement for the official postgres image (same environment variables and init scripts)
- Experimenting with a Rust-based database that is compatible with the PostgreSQL ecosystem
Getting started
Download and run pgrust on Linux:
PLATFORM=linux-x86_64
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-*/
bin/initdb -D /tmp/pgrust-data --no-locale --encoding UTF8 -U postgres
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
Connect from another terminal:
bin/psql -h /tmp -p 5432 -U postgres -c "select version()"
For Docker, macOS, and columnar table setup, see the repository README.
License and pricing
License: AGPL-3.0. Pricing: open source (no cost).
Based on the project's public README and repository metadata.