PG configuration file is the database directory of the postgresql.conf file, 8.0 later version can support k,m,g such parameters, as long as the corresponding parameters are modified to restart the PG service OK.
shared_buffers: This is the most important parameter, PostgreSQL deals with the kernel and the disk through shared_buffers, so it should be as large as possible, so that more data is cached in Shared_buffers. It is usually reasonable to set 10% of the actual RAM, such as 50000 (400M)
Work_mem: Before Pgsql 8.0 is called Sort_mem. When you perform a sort operation, PostgreSQL determines whether a large result set is split into smaller and work_mem-sized temporary files, depending on the size of the WORK_MEM. Obviously the result of the split is to reduce the speed of the sorting. Therefore, increasing the WORK_MEM helps to improve the speed of sorting. Typically set to 2%-4% of actual RAM, depending on the size of the result set you want to sort, such as 81920 (80M)
effective_cache_size: Is the maximum cache that PostgreSQL can use, and this number should be large enough for a standalone Pgsql server, such as 4G of memory, can be set to 3.5G (437500)
Maintence_work_mem: The memory defined here is only used when create INDEX, vacuum, etc., so the frequency is not high, but often these instructions consume more resources, so the instructions should be quickly executed as soon as possible: to MAINTENCE_WORK_MEM large memory, such as 512M ( 524288)
max_connections: Typically, the purpose of max_connections is to prevent max_connections * work_mem from exceeding the actual memory size. For example, if the Work_mem is set to 2% of the actual memory, then in extreme cases, if there are 50 queries that have sort requirements, and all use 2% of the memory, it will result in swap generation and system performance will be greatly reduced. Of course, if you have 4G of memory, the odds of having 50 of these large queries at the same time should be small. However, be clear about the relationship between Max_connections and Work_mem.
Reprint Address: http://blog.chinaunix.net/uid-280772-id-2135416.html
Several important parameters affecting the performance of PostgreSQL