Hanzo SQL is a PostgreSQL fork with pre-built extensions for AI workloads: pgvector (vector similarity), pgcron (scheduled jobs), pgdocumentdb (MongoDB wire protocol), and PostGIS (geospatial).
Category: Hanzo Ecosystem Related Skills: hanzo/hanzo-kv.md, hanzo/hanzo-platform.md, hanzo/hanzo-orm.md
Hanzo SQL is a PostgreSQL fork with pre-built extensions for AI workloads: pgvector (vector similarity), pg_cron (scheduled jobs), pg_documentdb (MongoDB wire protocol), and PostGIS (geospatial). Ships as ghcr.io/hanzoai/sql. Built on PostgreSQL 18 (Debian bookworm). Default branch: master. Port 5432.
hanzo, console, iam)conf/postgresql.conf optimized for vector operations and parallel queriesconfigure (autoconf)ghcr.io/hanzoai/sql (multi-stage Dockerfile, Debian bookworm)Repo: hanzoai/sql (PostgreSQL fork). The hanzo/ directory contains Hanzo-specific config, compose file, and init SQL.
vector,pg_cron,pg_documentdb_core,pg_documentdb| Item | Value | |------|-------| | Port | 5432 | | Image | ghcr.io/hanzoai/sql | | PG Version | 18 (bookworm) | | Default DB | hanzo | | Default User | hanzo | | Config | conf/postgresql.conf | | License | PostgreSQL License | | Repo | github.com/hanzoai/sql | | pgAdmin | port 5050 (via compose) |
docker run -d --name hanzo-sql \
-p 5432:5432 \
-e POSTGRES_DB=hanzo \
-e POSTGRES_USER=hanzo \
-e POSTGRES_PASSWORD=secret \
ghcr.io/hanzoai/sql
cd hanzo/
docker compose up -d
# Connect
docker exec -it hanzo-postgres psql -U hanzo -d hanzo
The hanzo/compose.yml starts PostgreSQL 17 with pgvector and pgAdmin:
services:
postgres:
image: pgvector/pgvector:pg17
container_name: hanzo-postgres
ports:
- "5432:5432"
environment:
POSTGRES_DB: hanzo
POSTGRES_USER: hanzo
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-hanzo_dev}
pgadmin:
image: dpage/pgadmin4:latest
container_name: hanzo-pgadmin
ports:
- "5050:80"
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:[email protected]}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
The Docker image builds and installs these extensions:
| Extension | Source | Purpose | |-----------|--------|---------| | pgvector | hanzoai/sql-vector | Vector similarity search | | pg_cron | citusdata/pg_cron v1.6.7 | Scheduled jobs | | pg_documentdb | microsoft/documentdb | MongoDB wire protocol | | PostGIS 3 | apt package | Geospatial data |
Init script (docker-entrypoint-initdb.d/01-extensions.sql) enables them on startup. DocumentDB extensions are wrapped in exception handlers so PostgreSQL starts even if they fail to load.
shared_preload_libraries = 'vector,pg_cron,pg_documentdb_core,pg_documentdb'
DocumentDB RUM extension uses graceful loading:
documentdb_core.rum_library_load_option = 'try_documentdb_extended_rum'
The hanzo/init.sql creates:
hanzo, console, iamhanzo_console, hanzo_iam, hanzo_readonlyhanzo.organizations, hanzo.projects, hanzo.embeddingshanzo.embeddings (1536-dim, cosine similarity)conf/postgresql.conf is tuned for AI workloads:
# Memory - tuned for vector operations
shared_buffers = 512MB
work_mem = 64MB
effective_cache_size = 1536MB
# Parallel queries - leverage multi-core for vector ops
max_parallel_workers_per_gather = 4
max_parallel_workers = 8
max_worker_processes = 16
# Connections
max_connections = 200
# WAL
wal_level = replica
max_wal_size = 2GB
hanzo/console -- AI observability metadata
hanzo/iam -- User/org data (Hanzo IAM)
hanzo/platform -- PaaS orchestration metadata
hanzo/kms -- Secret management data
Connection string pattern:
DATABASE_URL=postgresql://hanzo:password@localhost:5432/hanzo
sql/
README.md # Upstream PostgreSQL README
Dockerfile # Multi-stage: build extensions + runtime
Makefile # PostgreSQL build
meson.build # Meson build system
configure / configure.ac
conf/
postgresql.conf # Hanzo-tuned PostgreSQL config
docker-entrypoint-initdb.d/
01-extensions.sql # Auto-enable extensions on startup
hanzo/
LLM.md # Hanzo-specific documentation
compose.yml # Local dev compose (PG + pgAdmin)
init.sql # Schema, roles, tables, indexes
src/ # PostgreSQL source code
contrib/ # PostgreSQL contrib modules
doc/ # PostgreSQL documentation
config/ # Build configuration
git fetch upstream
git merge upstream/master
git checkout --ours hanzo/ # Preserve Hanzo customizations
git push origin master
| Issue | Cause | Solution | |-------|-------|----------| | documentdb extension not loaded | Missing shared_preload_libraries | Ensure pg_documentdb_core,pg_documentdb in config | | Vector index slow | IVFFlat needs more lists | Increase lists parameter or switch to HNSW | | pg_cron not working | Wrong database_name | Set cron.database_name to match your DB | | Connection refused | PG not ready | Wait for healthcheck: pg_isready -U hanzo -d hanzo | | Init SQL failed | Extension .so missing | Check Dockerfile build stage completed |
hanzo/hanzo-kv.md - Redis-compatible cachehanzo/hanzo-orm.md - Go ORM with PostgreSQL backendhanzo/hanzo-datastore.md - ClickHouse (OLAP)hanzo/hanzo-platform.md - PaaS deploymenthanzo/hanzo-universe.md - Production K8s infrastructureLast Updated: 2026-03-13 Category: Hanzo Ecosystem Related: sql, postgresql, pgvector, documentdb, database, multi-tenant Prerequisites: Docker or PostgreSQL build toolchain