To tune PostgreSQL parameters on a standby database with 16 CPUs and 16GB RAM for performance, consider the following settings:
hot_standby
: Set to on
to enable queries during recovery.max_standby_archive_delay
and max_standby_streaming_delay
: Adjust these for conflict resolution in replication. Start with the default and adjust based on experience.wal_receiver_status_interval
: Set to a lower value like 10 seconds for more frequent feedback to the primary.wal_receiver_timeout
: Adjust as needed, starting from the default.shared_buffers
: Set to about 4GB (25% of total RAM).effective_cache_size
: Set to around 12GB (75% of total RAM).work_mem
: Start with 256MB and adjust based on the query load.maintenance_work_mem
: Set higher than work_mem
, like 1GB, for maintenance tasks.max_parallel_workers
: Set to the number of CPUs, i.e., 16.max_parallel_workers_per_gather
: Begin with half of max_parallel_workers
, i.e., 8.