Henley Wing Chiu
Henley Wing Chiu

Reputation: 22535

Rule of thumb for Max Postgres connections to set?

As a rule of thumb, how many max connections should I set my Postgres server to have? For instance, if I have 8 GB of memory, and quad core 3.2 GHZ machine, and the server is dedicated to only Postgres, how many max connections would be safe?

Upvotes: 11

Views: 5970

Answers (1)

Wolph
Wolph

Reputation: 80061

There is no real rule of thumb since it really depends on your load.

  • If you do lots of tiny queries than you can easily increase the amount of connections.
  • If you have a few heavy queries, than you will probably increase the work_mem so you'll run out of memory with a lot of connections.

The basic thing is:

  • don't have more connections than your memory allows.
  • don't kill and recreate connections if possible (pgbouncer springs to mind)

Upvotes: 5

Related Questions