Skip to content

Configuring Postgres

Tune PostgreSQL runtime, performance, and operational settings like shared_buffers and work_mem via nhost.toml configuration.

PostgreSQL postgres configuration nhost.toml database settings shared buffers performance tuning wal settings

Postgres configuration can be tweaked to customize the runtime behavior, peformance, and operational aspects of your Postgres server instance.

To configure your Postgres instance, simply add the relevant settings under [postgres.settings] in your project’s nhost.toml file.

nhost.toml
[postgres]
version = '14-20230312-1'
[postgres.resources.compute]
cpu = 2000
memory = 4096
[postgres.resources.storage]
capacity = 20
[postgres.settings]
jit = 'off'
maxConnections = 100
sharedBuffers = '128MB'
effectiveCacheSize = '4GB'
maintenanceWorkMem = '64MB'
checkpointCompletionTarget = 0.9
walBuffers = '-1'
defaultStatisticsTarget = 100
randomPageCost = 4.0
effectiveIOConcurrency = 1
workMem = '4MB'
hugePages = 'try'
minWalSize = '80MB'
maxWalSize = '1GB'
maxWorkerProcesses = 8
maxParallelWorkersPerGather = 2
maxParallelWorkers = 8
maxParallelMaintenanceWorkers = 2
walLevel = 'replica'
maxWalSenders = 10
maxReplicationSlots = 10
trackIoTiming = 'on'