bitsCN.com
You generally want shared_buffers to be no more than 10% of availableram. Postgres expects the OS to do it's own caching. 128M/4G = 3% seemsreasonable to me. I would certainly never set it to 100% of ram.
登录后复制
This is the effective amount of caching between the actual postgresbuffers, and the OS buffers. If you are dedicating this machine topostgres, I would set it to something like 3.5G. If it is a mixedmachine, then you have to think about it.This does not change how postgres uses RAM, it changes how postgresestimates whether an Index scan will be cheaper than a Sequential scan,based on the likelihood that the data you want will already be cached inRam.If you dataset is only 85MB, and you don't think it will grow, youreally don't have to worry about this much. You have a very small database.
登录后复制
Max connections is just how many concurrent connections you want toallow. If you can get away with lower, do so.  Mostly this is to preventconnections * work_mem to get bigger than your real working memory andcausing you to swap.
登录后复制
sort_mem changed to work_mem in 8.0, same thing with vacuum_mem ->maintenance_work_mem.
登录后复制
Depends how much space you want to give per connection. 4M is prettysmall for a machine with 4G of RAM, but if your DB is only 85M it mightbe plenty.work_mem is how much memory a sort/hash/etc will use before it spills todisk. So look at your queries. If you tend to sort most of your 85M dbin a single query, you might want to make it a little bit more. But ifall of your queries are very selective, 4M could be plenty.I would make maintenance_work_mem more like 512M. It is only used forCREATE INDEX, VACUUM, etc. Things that are not generally done by morethan one process at a time. And it's nice for them to have plenty ofroom to run fast.
登录后复制
Good luck,John
登录后复制
bitsCN.com
09-15 00:49