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 settingsConfigure PostgreSQL in nhost.toml under [postgres.settings]. Use
nhost config example to see the full project configuration, including
Postgres version and resources.
For settings compatibility, set postgres.version to the latest supported
Postgres image for your PostgreSQL major version. Older images may accept
settings without applying them.
Settings
Section titled “Settings”[postgres.settings]jit = 'on'maxConnections = 100sharedBuffers = '128MB'effectiveCacheSize = '4GB'maintenanceWorkMem = '64MB'checkpointCompletionTarget = 0.9checkpointTimeout = '5min'walBuffers = '-1'walCompression = 'off'defaultStatisticsTarget = 100randomPageCost = 4.0effectiveIOConcurrency = 1workMem = '4MB'hugePages = 'try'minWalSize = '80MB'maxWalSize = '1GB'maxWorkerProcesses = 8maxParallelWorkersPerGather = 2maxParallelWorkers = 8maxParallelMaintenanceWorkers = 2walLevel = 'replica'maxWalSenders = 10maxReplicationSlots = 10maxSlotWalKeepSize = '-1'archiveTimeout = 300trackIoTiming = 'off'logMinDurationStatement = '-1'logAutovacuumMinDuration = '10min'logTempFiles = '-1'sharedPreloadLibraries = [ 'pg_stat_statements', 'pg_cron', 'timescaledb', 'pg_squeeze', 'pg_search']
[postgres.settings.extensions.pgStatStatements]max = 5000track = 'top'trackPlanning = 'off'
[postgres.settings.extensions.cron]timezone = 'GMT'maxRunningJobs = 32logRun = 'on'
[postgres.settings.extensions.pgDurable]maxUserConnections = 10retentionDays = 30logWorkflowSql = 'off'
[postgres.settings.extensions.timescaledb]maxBackgroundWorkers = 16Operational notes
Section titled “Operational notes”- Restart and downtime: Changing any setting under
postgres.settings, including extension settings, restarts PostgreSQL and causes a short period of database downtime. Plan changes accordingly. - WAL and replication: A finite
maxSlotWalKeepSizecan invalidate a lagging replication slot.archiveTimeoutis measured in seconds.checkpointTimeoutsets the maximum interval between automatic checkpoints;checkpointCompletionTargetcontrols how much of that interval a checkpoint uses. - Logging: Slow-statement logs may contain sensitive SQL.
extensions.pgDurable.logWorkflowSqldefaults tooffbecause substituted workflow SQL may contain secrets. - Background workers: Budget
extensions.timescaledb.maxBackgroundWorkersalongsidemaxWorkerProcessesand other extensions.
See the configuration reference for field types and defaults, and PostgreSQL server configuration for the underlying database settings.