pgrust: Rust-rewritten, Postgres-compatible high-performance database
pgrust is an open-source Postgres-compatible database reimplemented in Rust that preserves Postgres behavior while exploring multithreaded and AI-assisted architecture and performance improvements; suitable for research, validation, and performance comparison scenarios.
GitHub malisper/pgrust Updated 2026-07-12 Branch main Stars 2.1K Forks 50
Rust Relational Database Postgres-compatible High Performance AI-assisted Development Multithreaded Architecture Disk-compatible AGPL-3.0

💡 Deep Analysis

5
Does pgrust solve the difficulty of making internal changes to Postgres? How exactly does it address those core pain points?

Core Analysis

Project Positioning: pgrust provides a modern kernel implementation that remains behavior- and disk-compatible with Postgres 18.3, enabling architectural experiments without losing compatibility.

Technical Analysis

  • Regression tests as the spec: Using the official Postgres regression suite as an oracle reduces the risk of semantic regressions from deep changes.
  • Disk compatibility: Ability to boot from an existing Postgres 18.3 data directory allows realistic data-driven testing and simplifies migration benchmarks.
  • Rust rewrite lowers change cost: Rust’s memory-safety and concurrency primitives (and the move to thread-per-connection and built-in pooling) make deep storage or concurrency refactors more tractable.

Practical Recommendations

  1. Use as research/validation platform: Employ pgrust for kernel experiments, new storage designs, or concurrency model validation. Run scripts/run-regression to ensure behavioral parity.
  2. Compare with real data: Mount an existing Postgres 18.3 data directory in an isolated test environment and run regression and performance suites for comparison.
  3. Start with Docker/WasM demo: Use the Docker image or WebAssembly demo for initial evaluation to avoid build complexity.

Cautions

Important: pgrust is explicitly not production-ready. Extension compatibility (e.g., PL/Python) is limited and performance claims require independent reproduction.

Summary: pgrust meaningfully lowers barriers to experimenting with Postgres internals under a compatibility guarantee—an effective research and prototyping platform, not a drop-in production replacement.

85.0%
Why is rewriting Postgres in Rust a reasonable technical choice? What specific architectural advantages does pgrust provide?

Core Analysis

Project Positioning: Rewriting in Rust aims to bring memory safety, modern concurrency primitives, and lower refactoring cost to the database kernel, enabling thread model, storage, and runtime-protection experiments.

Technical Features

  • Memory safety and zero-cost abstractions: Rust’s borrow checker and type system catch many memory/concurrency bugs at compile time, reducing hard-to-reproduce kernel crashes.
  • Concurrency model improvements: Moving from process-per-connection to thread-per-connection reduces context-switch overhead, simplifies shared memory access, and can improve concurrency efficiency.
  • Experiment-friendly and verifiable: Disk compatibility + regression tests allow swapping storage implementations (e.g., no-vacuum) while ensuring behavioral correctness.
  • Runtime guardrails: The architecture supports adding kernel-level protections for malicious or AI-generated SQL, improving predictability.

Practical Recommendations

  1. Benchmark concurrency changes: Compare thread- vs process-per-connection under target workloads for context-switch cost, memory usage, and latency.
  2. Stage storage experiments: Run no-vacuum and custom storage layers on test data directories and validate using the regression suite.
  3. Validate implementation details: Rust reduces many classes of bugs, but performance hinges on lock strategy, memory layout, and IO model.

Cautions

Important: Language choice doesn’t automatically solve concurrency/performance issues. Poor locking or IO design will still create bottlenecks; validate via benchmarks and code review.

Summary: Rust gives a solid foundation for safer, more modifiable kernel design. pgrust’s architectural choices are sensible for experimentation, but practical gains depend on careful implementation and verification.

85.0%
As an operator/DBA, what user-experience and practical challenges will you encounter when migrating existing Postgres data to pgrust for testing?

Core Analysis

Key Issue: pgrust can boot from a Postgres 18.3 data directory, making migration-for-testing attractive—but build dependencies, extension compatibility, and testing workload complicate the operational experience.

Technical Analysis

  • Disk compatibility benefit: Enables realistic behavior and performance testing without dump/restore, reducing noise.
  • Build/run requirements: Building requires PGRUST_PGSHAREDIR, RUST_MIN_STACK and system libraries such as icu4c, openssl@3, and libpq. Misconfiguration can break startup or regression runs.
  • Extension/PL limitations: Many third-party extensions and procedural languages are not yet supported, so databases relying on them will need migration or workarounds.

Practical Recommendations

  1. Test in an isolated environment: Copy production data to a separate node—do not run tests on a live production directory.
  2. Audit extension dependencies: Inventory all extensions/PLs and verify support or identify substitutes before testing.
  3. Start with Docker/WasM: Use the official Docker image or WasM demo to validate basic compatibility before building from source.
  4. Run regression & performance suites: Use scripts/run-regression plus your own benchmarks to validate behavior and performance claims.

Cautions

Important: pgrust is not production-ready and has limited extension support; do not switch production workloads directly.

Summary: Disk compatibility lowers the testing barrier, but operational challenges (build environment, extensions, comprehensive testing) require careful preparation and isolation.

85.0%
Are pgrust's performance claims (transactions +50%, analytics ~300x) reliable? How should one validate these performance improvements?

Core Analysis

Key Issue: pgrust’s README reports large performance gains, but without published, reproducible benchmark details—these numbers must be validated via rigorous, comparable testing.

Technical Analysis

  • Claims lack detailed context: Percentages and multiples are provided without hardware, IO, concurrency, or query-set details, all of which greatly affect outcomes.
  • Implementation/configuration matter: IO mode (sync/async), locking, cache management, and concurrency model have major impacts on performance.
  • Reproducibility supported: Docker image, WasM demo, and regression test runner are provided to help build comparable test setups.

Practical Steps to Validate

  1. Create a comparable baseline: On the same hardware, run Postgres 18.3 against the same data directory and record DB/system parameters.
  2. Fix system variables: Lock IO scheduler, fsync, CPU freq, NUMA, memory, and disk cache to ensure a fair comparison.
  3. Use standardized benchmarks: Run transactional (e.g., TPC-C/pgbench) and analytical (e.g., clickbench) workloads, plus the README’s example workloads.
  4. Collect low-level metrics: Measure CPU, IOPS, latency, context switches, lock waits, and cache hit rates to locate bottlenecks.
  5. Publish reproduction steps: Record and share configurations and scripts to make results auditable.

Cautions

Important: Superior performance in some tests does not guarantee similar gains across all production workloads, especially where extensions/PLs are essential.

Summary: Treat pgrust’s performance claims as hypotheses to be tested. Only through controlled baselining, standardized benchmarks, and thorough telemetry can you confirm benefits for your workloads.

85.0%
In which scenarios should you choose pgrust for evaluation or prototyping? What clear limitations make it unsuitable for some use cases?

Core Analysis

Key Issue: When to choose pgrust for evaluation/prototyping, and when to avoid it.

Suitable Scenarios

  • Kernel research & architectural experiments: Teams testing new storage designs (e.g., no-vacuum), concurrency models, or runtime protections.
  • Compatibility/migration evaluation: DBAs who want to compare behavior/performance against real data directories without dump/restore.
  • Prototyping & teaching: Educational contexts or early prototyping where regression tests act as behavioral verification.

Unsuitable Scenarios (Limitations)

  • Production replacement: pgrust is explicitly not production-ready and lacks long-term maintenance and HA guarantees.
  • Heavy extension/PL reliance: Many extensions and PLs (e.g., PL/Python) are not yet compatible, blocking direct migration.
  • License-sensitive commercial use: AGPL-3.0 can restrict embedding in closed-source products.
  • Cross-version or custom Postgres builds: Compatibility is targeted at Postgres 18.3; other versions/custom builds are not guaranteed.

Practical Recommendations

  1. Use pgrust as an experimental platform: Run storage, concurrency, or planner experiments in isolation and validate with the regression suite.
  2. Assess extension dependencies: Identify critical extensions and evaluate porting effort or alternatives before committing.
  3. Review licensing implications: Perform legal review before integrating into commercial/closed-source offerings.

Cautions

Important: pgrust aims to be “experimentable, replaceable, and measurable,” but currently serves research and prototyping needs rather than production workloads.

Summary: pgrust is valuable for kernel-level experiments and migration testing under compatibility guarantees; for production workloads requiring ecosystem completeness and stable maintenance, stick with mature Postgres distributions or commercial engines.

85.0%

✨ Highlights

  • Matches Postgres across >46,000 regression tests
  • Disk-compatible with Postgres 18.3; can boot from existing data directory
  • Claims significant transaction and analytical performance gains over Postgres
  • Low community activity: 0 contributors, 0 stars — notable maintenance risk

🔧 Engineering

  • Aims for Postgres-behavior compatibility using real regression tests as the oracle
  • Designed for disk-level compatibility; can start from a Postgres 18.3 data directory
  • Implemented in Rust and leverages AI-assisted development to explore internal server changes

⚠️ Risks

  • Not production-ready; documentation and performance require further optimization
  • Limited compatibility with existing extensions and procedural languages (e.g., PL/Python)
  • Sparse community and maintenance resources; uncertain long-term support and security response
  • Released under AGPL-3.0 which may impose restrictions on closed-source commercial use

👥 For who?

  • Database researchers and core storage/query-engine developers
  • Engineering teams seeking Postgres compatibility with performance or architecture improvements
  • Open-source contributors willing to test, validate and contribute in non-production environments