Dedicated server guidelines
Initial server tuning can be turned into a fairly mechanical process:
- Adjust the logging default to be more verbose.
- Determine how large to set
shared_buffers
to. Start at 25 percent of system memory. Considering adjusting upward if you're on a recent PostgreSQL version with spread checkpoints and know your workload benefits from giving memory directory to the buffer cache. If you're on a platform where this parameter is not so useful, limit its value or adjust downward accordingly. - Estimate your maximum connections generously, as this is a hard limit; clients will be refused connection once it's reached.
- Start the server with these initial parameters. Note how much memory is still available for the OS filesystem cache.
- Adjust
effective_cache_size
based onshared_buffers
plus the OS cache. - Divide the OS cache size by
max_connections
, then by two. This gives you an idea of a maximum reasonable setting forwork_mem
. If your application is not...