A lightweight Postgres-compatible database runtime in Rust that hosts thousands of short-lived, isolated databases for agents, CI and tests.
At a Glance
PGX core runtime, a Postgres-compatible database written in Rust, licensed under AGPL-3.0 (OSI-approved). Currently in beta (v0.1).
Engagement
Available On
Alternatives
Listed Nov 2026
About PGX
PGX is an open-source, Postgres-compatible database runtime written in Rust and published by the pgrundev organization. It is built for short-lived databases such as agent sandboxes, CI and per-PR databases, and test and preview environments. The project is in beta, and v0.1 is intended for disposable databases.
What It Is
PGX runs many isolated databases inside a single process instead of giving each one its own PostgreSQL server. It speaks the Postgres wire protocol and SQL dialect, so PostgreSQL clients and ORMs such as Rails, Django, Prisma, SQLAlchemy and node-postgres connect to it unchanged. Databases are created from sealed templates and cleaned up automatically after a TTL or a grace period following the last session.
Workflow and Branching
A typical flow starts with installing the CLI, running pgx run, and cloning a database with pgx clone app agent-001 --ttl 5m. Clones are copy-on-write branches on backends with block cloning such as ZFS, and full copies on other filesystems. Connecting to a name of the form <prefix><template>__<token> mints a database from a sealed template, with a warm pool of pre-created spares serving bursts. A background supervisor drops temporary databases after their deadline, and pgrust_runtime_status() returns JSON with databases, sessions, memory and pool counters.
Isolation and Resource Limits
Databases are isolated by name, roles and limits within the shared runtime. Memory limits apply at session, database and runtime level, per-database connection limits are available, and a Linux cgroup can wrap the runtime. Memory-heavy work fails with a PostgreSQL-style error (SQLSTATE 53200) rather than crashing the runtime.
Current Status and Limits
The README describes PGX as beta software. It is documented as not a production primary, system of record, or HA/PITR database. It runs with fsync = off, so it is not crash-safe. A runtime is a single crash domain. Existing PostgreSQL C extensions cannot load; only built-in contrib modules such as pgvector are available, and PL/Python, PL/Perl and PL/Tcl are unavailable.
Benchmarks and Relationship to PGRun
The README reports benchmark figures from its own scripts, for example about 6.2 ms p50 to mint a warm database and 219 of 231 PostgreSQL regression tests byte-exact, with the rest differing only in EXPLAIN text. It states these describe measured configurations, not a general speed claim over PostgreSQL. Short statements run about 0.05-0.15 ms slower than PostgreSQL 18. PGX is the engine behind PGRun branches; PGRun is a separate project that adds the control plane. PGX is built on the pgrust project and licensed under AGPL-3.0.
Community Discussions
Be the first to start a conversation about PGX
Share your experience with PGX, ask questions, or help others learn from your insights.
Pricing
Open Source (Self-hosted)
PGX core runtime, a Postgres-compatible database written in Rust, licensed under AGPL-3.0 (OSI-approved). Currently in beta (v0.1).
- AGPL-3.0 licensed
- Portions derived from PostgreSQL remain under the PostgreSQL License
- No Docker required
- Native Mac & Linux
- Automatic cleanup of disposable databases
Capabilities
Key Features
- Many isolated Postgres-compatible databases in one runtime
- Millisecond database minting from sealed templates
- Copy-on-write branching on ZFS block cloning
- TTL-based automatic cleanup of temporary databases
- Warm pool of pre-created databases
- Session, database and runtime memory limits
- Per-database connection limits
- Linux cgroup containment
- Machine-readable runtime status via pgrust_runtime_status()
- Postgres wire protocol and SQL compatibility
- Built-in contrib modules including pgvector
- CLI for run, clone, create, ls, ttl and url
