PostgreSQL Driver
Configure Compozy with PostgreSQL for production-grade reliability, pgvector search, and high concurrency.
Why PostgreSQL
High Concurrency
pgvector Integration
Managed Services
Configuration Options
PostgreSQL is selected when database.driver is omitted or set to postgres. You can configure via either a connection string or individual parameters.
database:
driver: postgres # default, can be omitted
host: localhost
port: 5432
user: compozy
password: ${DB_PASSWORD}
dbname: compozy
sslmode: require
max_open_conns: 25
max_idle_conns: 5
knowledge:
vector_dbs:
- id: main
provider: pgvector
dimension: 1536Connection String Support
database:
driver: postgres
conn_string: postgres://compozy:${DB_PASSWORD}@db.internal:5432/compozy?sslmode=requireParameter Reference
| Field | Required | Description |
|---|---|---|
host | Yes* | Hostname or IP of the PostgreSQL server (*omit when using conn_string). |
port | No | Server port (default 5432). |
user | Yes* | Database user used for all connections. |
password | Yes* | Password or secret for the database user. |
dbname | Yes* | Database name that stores Compozy metadata. |
sslmode | No | TLS mode: disable, require, verify-ca, or verify-full. |
max_open_conns | No | Upper bound for concurrent connections (defaults to driver auto-tuning). |
max_idle_conns | No | Idle pool size to keep warm for bursty workloads. |
Environment variables are supported via the CLI (COMPOZY_DB_*) and align with the configuration fields listed above.
pgvector for Knowledge Bases
CREATE EXTENSION IF NOT EXISTS vector;- Set
knowledge.vector_dbs[].providertopgvector. - Ensure
dimensionmatches the embedding model size (e.g., 1536 for OpenAI text-embedding-3-large). - Use managed services like Neon or Supabase that ship with pgvector to avoid manual installation.
Performance Tuning
- Connection Pooling
Tune
max_open_connsandmax_idle_connsto match database limits; start with 25/5 and monitor saturation. - Prepared Statements
Compozy uses prepared statements via
pgx, reducing parse overhead for repetitive workflow queries. - Autovacuum
Keep autovacuum enabled; repositories write frequently and benefit from automatic cleanup.
- Index Strategy
Migrations ship with indexes tuned for workflow/task lookups. Add partial indexes for custom workload filters if needed.
Production Deployment Guide
Provision the Database
Install pgvector
Configure Secrets
Run Migrations
Scale Intelligently
CLI Reference
# Override default driver (explicit but optional)
compozy start --db-driver=postgres
# Supply connection string on the command line
COMPOZY_DB_CONN_STRING="postgres://..." compozy start