Find these settings in the postgresql.conf file for the desired PostgreSQL instance and 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 4GB for servers with up to 64 GB of RAM. Use 8GB for systems with more than 64 GB of RAM.
- 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 two.
- Set maintenance_work_mem to 1GB ...