I am using PGTune to help tune my web application using PostgreSQL 9.5
Some background - The web app is a real estate search site, with up to 200 active users during the day performing fairly complex location-based queries. GeoDjango is used to host the site.
My question is about tuning work_mem and max_connections. In PGTune, I noticed that when I increase max_connections, the recommended work_mem decreases. I had several questions in mind:
- As a rule of thumb, should you keep
max_connectionsas low as possible, to allow for morework_memto be freed up for better performance for each individual query? - For a website with up to 200 active users at a time, constantly performing queries - what number of
max_connectionsI should have? - I currently have my
max_connectionsset to 500 and the recommendedwork_memby PGTune is 8388kB. Is it worth reducingmax_connectionsto 400 or maybe 300, which allows me to increasework_mem?