Skip to content

PostgreSQL Configuration Tuning

DeltaFi uses two PostgreSQL instances with different workload profiles. Both are configurable via Helm values (Kubernetes) or site values (Compose).

Instances

InstancePurposeDefault shared_buffersDefault max_connections
deltafi-postgresDeltaFile metadata, state, configuration128MB1000
deltafi-postgres-lookupLookup tables (key/value store)32MB100

The lookup instance is only deployed when deltafi.lookup.enabled is set to true.

Parameters

Tunable Parameters

ParameterMain DefaultLookup DefaultDescription
shared_buffers128MB32MBPostgreSQL's shared memory buffer pool. Recommend 25% of available RAM for the main instance.
max_connections1000100Maximum concurrent database connections.
log_statementddlddlWhich SQL statements to log. ddl logs schema changes.
log_min_duration_statement10001000Log queries taking longer than this many milliseconds.
log_autovacuum_min_duration00Log all autovacuum runs. Essential for visibility at scale.
random_page_cost1.11.1Query planner cost estimate for random page access. 1.1 is correct for SSD storage.
effective_io_concurrency200200Number of concurrent I/O operations for bitmap heap scans. 200 is appropriate for SSD.

Helm-Only Parameters

These additional parameters are set in Kubernetes deployments via the Zalando Postgres Operator:

ParameterMain DefaultLookup DefaultDescription
log_destinationstderrstderrWhere to send log output.
logging_collectoroffoffWhether to use the logging collector subprocess.
log_connectionsoffoffLog each new connection.
log_disconnectionsoffoffLog each disconnection.
max_worker_processes164Maximum background worker processes.
timescaledb.max_background_workers164TimescaleDB background workers.
wal_levellogicallogicalWAL detail level. logical enables logical replication.
max_replication_slots11Maximum replication slots.

Overriding Parameters

Kubernetes (Helm)

Override in your Helm values file:

yaml
postgres:
  parameters:
    shared_buffers: "2GB"        # 25% of 8GB host RAM
    max_connections: "500"
  lookup:
    parameters:
      shared_buffers: "64MB"

Values merge with defaults — you only need to specify what you're changing.

Compose

Override in site/values.yaml:

yaml
postgres:
  parameters:
    shared_buffers: 2GB          # 25% of 8GB host RAM
  lookup:
    parameters:
      shared_buffers: 64MB

Then run deltafi up to apply.

Sizing Recommendations

shared_buffers

The most impactful parameter. PostgreSQL uses this as its primary cache for table and index data.

Host RAMRecommended shared_buffers (main)Recommended shared_buffers (lookup)
4GB512MB32MB
8GB2GB32MB
16GB4GB64MB
32GB8GB64MB
64GB+16GB128MB

General rule: 25% of available RAM for the main instance. The lookup instance handles a small dataset and rarely needs more than 64MB.

max_connections

Default of 1000 is sufficient for most deployments. Each connection consumes ~5-10MB of memory. If you reduce max_connections, you free memory for shared_buffers.

Verifying Settings

After applying changes, verify they took effect:

bash
# Kubernetes
kubectl exec -it deltafi-postgres-0 -- psql -U postgres -c "SHOW shared_buffers; SHOW max_connections; SHOW random_page_cost; SHOW effective_io_concurrency; SHOW log_autovacuum_min_duration;"

# Compose
docker exec deltafi-postgres psql -U postgres -c "SHOW shared_buffers; SHOW max_connections; SHOW random_page_cost; SHOW effective_io_concurrency; SHOW log_autovacuum_min_duration;"

Advanced Tuning

For deployments with specific hardware or workload requirements, additional PostgreSQL parameters can be added to the parameters map. Common candidates:

  • effective_cache_size — Estimate of OS disk cache available to PostgreSQL. Typically 50-75% of total RAM.
  • work_mem — Memory per sort/hash operation. Higher values speed up complex queries but multiply by max_connections.
  • maintenance_work_mem — Memory for maintenance operations (VACUUM, CREATE INDEX). Can be set higher than work_mem.

These are site-specific and should be tuned based on observed query performance. See the PostgreSQL documentation for details.

Contact US