minipg: PostgreSQL 18 in a Single Binary with Databases Stored in a .pgdb FolderBrief · digest for November 28
Brief≈ 2 min

minipg: PostgreSQL 18 in a Single Binary with Databases Stored in a .pgdb Folder

For local tests, it's tempting to reach for SQLite: one file, no Docker, no background services. Then production PostgreSQL surprises you with type and locking differences. minipg by Jeff Lindsay (progrium) closes that gap: it packs postgres:18-alpine into a single Zig binary and stores the database in a .pgdb folder containing config and pgdata/.

Under the hood runs hyper9 (h9), a thin layer over OS hypervisors (KVM, Apple Silicon, Windows WHP) without booting a full Linux kernel. On Linux x86_64 5.11+, it works without /dev/kvm or --privileged, so it runs on standard GitHub Actions runners.

# Create app.pgdb and open psql
minipg app.pgdb

# Run tests with a temporary database and DATABASE_URL
minipg run test.pgdb -- go test ./...

# Print the connection URL or take a dump
minipg url app.pgdb
minipg dump app.pgdb > dump.sql

The server boots on 127.0.0.1 on the first request and shuts down after 60 seconds idle (MINIPG_IDLE). Initializing .pgdb takes ~4 seconds, cluster locale is C.UTF-8, and minipg init --pg 17 pulls another version.

It's too early to put the GitHub source in production: hyper9 is still a prototype, so don't trust it with valuable data. Without KVM on Linux, it's 2–12x slower than native Postgres, uses ~33 MB per connection, has JIT off, reserves 5 GB on Windows, and lacks Windows on ARM—yet for local tests and CI, it's plenty.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 3