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

Making changes should be done with caution, especially in a production environment, as incorrect settings can affect the stability and performance of Postgres.

Configuration Example

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

Resources