Zero-dependency embedded PostgreSQL - Run PostgreSQL locally without installation. A single binary that downloads and manages PostgreSQL for you.
Includes pgvector for AI/vector workloads out of the box.
- Zero dependencies - single binary, no installation required
- Embedded PostgreSQL 16 with pgvector pre-installed
- Multiple instances - run multiple PostgreSQL servers simultaneously
- Works on macOS (Apple Silicon), Linux (x86_64), and Windows (x64)
- Bundled
psqlclient - no separate installation needed - Data persists between restarts
curl -fsSL https://raw.githubusercontent.com/vectorize-io/pg0/main/install.sh | bashOr with a custom install directory:
INSTALL_DIR=/usr/local/bin curl -fsSL https://raw.githubusercontent.com/vectorize-io/pg0/main/install.sh | bash# Start PostgreSQL
pg0 start
# Connect with psql
pg0 psql
# Use pgvector
pg0 psql -c "CREATE EXTENSION IF NOT EXISTS vector;"
pg0 psql -c "CREATE TABLE items (embedding vector(3));"
pg0 psql -c "INSERT INTO items VALUES ('[1,2,3]');"
# Stop when done
pg0 stop# Start with defaults (port 5432)
pg0 start
# Start with custom options
pg0 start --port 5433 --username myuser --password mypass --database myapppg0 stop# Human-readable format
pg0 info
# JSON output
pg0 info -o json
# Info for a specific instance
pg0 info --name myapp# List all instances
pg0 list
# JSON output
pg0 list -o json# Interactive shell
pg0 psql
# Run a single command
pg0 psql -c "SELECT version();"
# Run a SQL file
pg0 psql -f schema.sqlpgvector is pre-installed. Just enable it:
pg0 psql -c "CREATE EXTENSION IF NOT EXISTS vector;"Then use it for vector similarity search:
-- Create a table with vector column
CREATE TABLE items (id serial PRIMARY KEY, embedding vector(1536));
-- Insert vectors
INSERT INTO items (embedding) VALUES ('[0.1, 0.2, ...]');
-- Find similar vectors
SELECT * FROM items ORDER BY embedding <-> '[0.1, 0.2, ...]' LIMIT 5;Run multiple PostgreSQL servers simultaneously using named instances:
# Start multiple instances on different ports
pg0 start --name app1 --port 5432
pg0 start --name app2 --port 5433
pg0 start --name test --port 5434
# List all instances
pg0 list
# Get info for a specific instance
pg0 info --name app1
# Connect to a specific instance
pg0 psql --name app2
# Stop a specific instance
pg0 stop --name test
# Stop all (one by one)
pg0 stop --name app1
pg0 stop --name app2Each instance has its own data directory at ~/.pg0/instances/<name>/data/.
For extensions beyond pgvector:
# List available extensions
pg0 list-extensions
# Install an extension
pg0 install-extension <name> -v, --verbose Enable verbose logging
pg0 start [OPTIONS]
Options:
--name <NAME> Instance name [default: default]
-p, --port <PORT> Port to listen on [default: 5432]
-d, --data-dir <DATA_DIR> Data directory [default: ~/.pg0/instances/<name>/data]
-u, --username <USERNAME> Username [default: postgres]
-P, --password <PASSWORD> Password [default: postgres]
-n, --database <DATABASE> Database name [default: postgres]
-c, --config <KEY=VALUE> PostgreSQL config option (can repeat)
pg0 applies optimized defaults for vector/AI workloads:
shared_buffers=256MBmaintenance_work_mem=512MB(faster index builds)effective_cache_size=1GBmax_parallel_maintenance_workers=4work_mem=64MB
Override any setting with -c:
# Custom memory settings
pg0 start -c shared_buffers=512MB -c work_mem=128MB
# For larger workloads
pg0 start -c shared_buffers=1GB -c maintenance_work_mem=2GBOn first run, pg0 downloads PostgreSQL from theseus-rs and pgvector from pre-compiled binaries. These are cached in ~/.pg0/installation/ for subsequent runs.
Data is stored in ~/.pg0/instances/<name>/data/ (or your custom --data-dir) and persists between restarts.
cargo build --releaseThe binary will be at target/release/pg0.
MIT