PostgreSQL Protocol Configuration
PostgreSQL Protocol Configuration
Complete configuration reference for HeliosDB’s PostgreSQL protocol implementation.
Server Configuration
Network Settings
[postgresql]# Listen address for PostgreSQL wire protocollisten_address = "0.0.0.0"
# PostgreSQL wire protocol port (default: 5432)port = 5432
# Maximum concurrent connectionsmax_connections = 100
# Connection timeout in secondsconnection_timeout = 60
# Idle connection timeout (0 = disabled)idle_timeout = 300Authentication
[postgresql.auth]# Authentication methods: "password", "md5", "scram-sha-256"method = "scram-sha-256"
# Password file location (HBA-style)hba_file = "/etc/heliosdb/pg_hba.conf"
# Enable SSL authenticationssl_auth = false
# Certificate-based authenticationcert_auth = falseSSL/TLS Configuration
[postgresql.ssl]# Enable SSL connectionsenabled = true
# SSL mode: "disable", "allow", "prefer", "require", "verify-ca", "verify-full"mode = "prefer"
# Certificate filescert_file = "/etc/heliosdb/server.crt"key_file = "/etc/heliosdb/server.key"ca_file = "/etc/heliosdb/ca.crt"
# Minimum TLS version: "1.2", "1.3"min_version = "1.2"
# Cipher suites (leave empty for defaults)ciphers = ""Protocol Settings
[postgresql.protocol]# Wire protocol version (3.0 is standard)version = "3.0"
# Extended query protocol supportextended_query = true
# Prepared statement cache size per connectionprepared_statement_cache = 100
# Maximum parameter countmax_parameters = 65535
# Message size limitsmax_message_size = "1GB"COPY Protocol
[postgresql.copy]# Enable COPY commandenabled = true
# Default format: "text", "csv", "binary"default_format = "text"
# Maximum rows per batchbatch_size = 10000
# ON_ERROR default: "stop", "ignore"on_error = "stop"
# Enable error loggingerror_logging = true
# Maximum errors to logmax_errors_logged = 1000Replication Settings
[postgresql.replication]# Enable replication protocolenabled = true
# Logical replication supportlogical_replication = true
# Physical replication supportphysical_replication = true
# Replication slot failoverslot_failover = true
# Maximum replication connectionsmax_replication_connections = 10
# WAL sender timeout (ms)wal_sender_timeout = 60000Connection String Parameters
Standard PostgreSQL connection string format:
postgresql://[user[:password]@][host][:port][/database][?parameters]Supported Parameters
| Parameter | Description | Default |
|---|---|---|
host | Server hostname | localhost |
port | Port number | 5432 |
dbname | Database name | postgres |
user | Username | - |
password | Password | - |
sslmode | SSL mode | prefer |
sslcert | Client certificate | - |
sslkey | Client key | - |
sslrootcert | CA certificate | - |
connect_timeout | Connection timeout | 0 (infinite) |
application_name | Application name | - |
options | Command-line options | - |
keepalives | Enable TCP keepalives | 1 |
keepalives_idle | Keepalive idle time | 0 |
target_session_attrs | Session attributes | any |
Connection Examples
# Basic connectionpostgresql://localhost/mydb
# With authenticationpostgresql://user:password@localhost:5432/mydb
# With SSLpostgresql://user:password@localhost/mydb?sslmode=require
# Full connection stringpostgresql://user:password@host1:5432,host2:5432/mydb?sslmode=verify-full&target_session_attrs=read-writeEnvironment Variables
HeliosDB respects standard PostgreSQL environment variables:
| Variable | Description |
|---|---|
PGHOST | Default hostname |
PGPORT | Default port |
PGDATABASE | Default database |
PGUSER | Default username |
PGPASSWORD | Password (not recommended) |
PGPASSFILE | Password file location |
PGSSLMODE | SSL mode |
PGSSLCERT | SSL certificate |
PGSSLKEY | SSL key |
PGSSLROOTCERT | SSL root certificate |
Performance Tuning
Connection Pooling
[postgresql.pooling]# Enable server-side connection poolingenabled = true
# Pool mode: "session", "transaction", "statement"pool_mode = "transaction"
# Minimum pool sizemin_pool_size = 10
# Maximum pool sizemax_pool_size = 100
# Connection lifetime (seconds)max_connection_lifetime = 3600
# Idle connection timeoutidle_timeout = 300Query Optimization
[postgresql.query]# Enable query cachingquery_cache = true
# Query cache size (MB)query_cache_size = 256
# Statement timeout (ms, 0 = disabled)statement_timeout = 0
# Lock timeout (ms, 0 = disabled)lock_timeout = 0
# Enable parallel queryparallel_query = true
# Maximum parallel workersmax_parallel_workers = 4Memory Settings
[postgresql.memory]# Work memory per operation (MB)work_mem = 64
# Maintenance work memory (MB)maintenance_work_mem = 256
# Shared buffers (MB)shared_buffers = 1024
# Effective cache size (MB)effective_cache_size = 4096Monitoring
Session Variables
Query current settings using standard PostgreSQL commands:
-- Show all settingsSHOW ALL;
-- Show specific settingSHOW work_mem;
-- Set session variableSET work_mem = '128MB';
-- Show server versionSELECT version();System Catalogs
Available PostgreSQL-compatible system catalogs:
pg_catalog.pg_database- Databasespg_catalog.pg_tables- Tablespg_catalog.pg_indexes- Indexespg_catalog.pg_stat_user_tables- Table statisticspg_catalog.pg_stat_activity- Active sessionspg_catalog.pg_locks- Current locksinformation_schema.*- Standard information schema
Troubleshooting
Connection Issues
# Test connectionpsql -h localhost -p 5432 -U user -d database -c "SELECT 1"
# Check SSLpsql "postgresql://localhost/db?sslmode=require" -c "SELECT ssl_is_used()"
# Verbose connectionPGSSLMODE=require psql -h localhost -d db -vCommon Errors
| Error | Cause | Solution |
|---|---|---|
| Connection refused | Server not running | Check server status |
| Authentication failed | Wrong credentials | Verify username/password |
| SSL required | SSL mode mismatch | Configure sslmode |
| Too many connections | Max connections reached | Increase max_connections |
Related: README.md | COMPATIBILITY.md | EXAMPLES.md
Last Updated: December 2025