Files
postgres/conf/postgresql.conf
zeekay b99bbd985a fix: make ZAP opt-in so hanzo/sql works as vanilla PostgreSQL
The zap_fdw background worker previously always registered itself and
connected to a hardcoded "postgres" database. This broke deployments
that don't use ZAP or use a different database name.

Changes:
- Add zap.enabled GUC (default false) — worker only starts when true
- Add zap.database GUC — falls back to POSTGRES_DB env var then "postgres"
- Build zap_fdw in Dockerfile but keep it out of shared_preload_libraries
- Fix compile errors: move got_sigterm before use, add signal handler
- Fix Makefile PG_MAJOR (16 -> 18), compose.yml (use hanzo/sql:18)
- Remove hardcoded database names from healthchecks and init.sql
- Trigger CI on contrib/zap_fdw/** changes
2026-03-30 19:15:44 -07:00

68 lines
1.9 KiB
Plaintext

# Hanzo SQL - PostgreSQL configuration tuned for AI workloads
# https://github.com/hanzoai/sql
# Connection
listen_addresses = '*'
port = 5432
max_connections = 200
# Memory - tuned for vector operations and large working sets
shared_buffers = 512MB
work_mem = 64MB
maintenance_work_mem = 256MB
effective_cache_size = 1536MB
# WAL
wal_level = replica
max_wal_size = 2GB
min_wal_size = 256MB
checkpoint_completion_target = 0.9
# Query planner - favor index scans for vector similarity
random_page_cost = 1.1
effective_io_concurrency = 200
default_statistics_target = 100
# Parallel queries - leverage multi-core for vector ops
max_parallel_workers_per_gather = 4
max_parallel_workers = 8
max_parallel_maintenance_workers = 4
max_worker_processes = 16
# Logging
log_min_duration_statement = 1000
log_checkpoints = on
log_connections = off
log_disconnections = off
log_lock_waits = on
log_timezone = 'UTC'
# Locale
timezone = 'UTC'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
# Extensions
# pg_documentdb_core and pg_documentdb must be in shared_preload_libraries;
# pg_documentdb_extended_rum_core is loaded at runtime by pg_documentdb_core
shared_preload_libraries = 'vector,pg_cron,pg_documentdb_core,pg_documentdb'
# pg_cron - run jobs in any database (not just postgres)
cron.database_name = 'postgres'
# pgvector specific - HNSW index build parallelism
max_parallel_maintenance_workers = 4
# pg_documentdb - RUM library load option
# Default is 'require_documentdb_extended_rum' which crashes if the .so has missing deps.
# Use 'try' so PG starts even if the RUM extension fails to load.
documentdb_core.rum_library_load_option = 'try_documentdb_extended_rum'
# ZAP binary protocol (disabled by default — vanilla PG behavior)
# To enable ZAP, add 'zap_fdw' to shared_preload_libraries above, then:
#zap.enabled = true
#zap.port = 9651
#zap.database = '' # empty = use POSTGRES_DB env var, then fallback to 'postgres'