Find these settings in the postgresql.conf file for the desired PostgreSQL instance, and then perform the following steps:
- Set max_connections to three times the number of processor cores on the server. Include virtual (hyperthreading) cores.
- Set shared_buffers to 25 percent of RAM for servers with up to 32 GB of RAM. For larger servers, start with 8GB and then test for higher values in increments of 2 GB.
- Set work_mem to 8MB for servers with up to 32 GB of RAM, 16MB for servers with up to 64 GB of RAM, and 32MB for systems with more than 64 GB of RAM. If max_connections is greater than 400, divide this by 2.
Systems with exceedingly large amounts of RAM (that is, 256 GB and higher) do not require artificially halving the ...