I have a question regarding max_connections in postgresql.conf.

In the Postgresql documentation, it says it determines the maximum number of concurrent connections to the database server. Does it literally mean users connected to it? or am I missing something?


It is the number of connections. It is not the number of users, as one user can have many connections concurrently and each one counts against max_connections. And you can also have many more users than connections, as long as users are not permanently connected.

  • Appreciate the concise explanation! – Axel Sep 27 '19 at 13:47

A database connection consists of a TCP (or UNIX socket) network connection to the database machine and a server process on the database machine that serves client queries. You can see active connections in the view pg_stat_activity.

That is what is limited by max_connections.

Do not confuse concurrent users in your application with concurrent database connections. If you use connection pooling as you should, a database connection can handle requests from many application users.

  • Thank you for explaining it thoroughly. The postgresql documentation was a bit confusing! – Axel Sep 27 '19 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.