Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the connection limit per user on Postgresql?

I need to find out if a connection limit has been set on a Postgresql database on a per user basis.

I know you can set such a limit using:

ALTER USER johndoe WITH CONNECTION LIMIT 2; 

Can you check this in the pg_users table?

like image 945
miller_121 Avatar asked Jan 06 '11 15:01

miller_121


People also ask

How many connections can I have Postgres?

PostgreSQL Connection Limits 15 connections are reserved for the superuser to maintain the state and integrity of your database, and 100 connections are available for you and your applications. If the number of connections to the database exceeds the 100-connection limit, new connections fail and return an error.

How do you check how many connections are open in Postgres?

SELECT * FROM pg_stat_activity WHERE datname = 'dbname' and state = 'active'; Show activity on this post.

How do I find my PostgreSQL connection details?

Using pgAdminIn the Browser pane, select our database (1) and then click on the Dashboard tab (2). In the bottom of page there is Server Activity panel which contain all connected sessions (3).

How many concurrent connections to PostgreSQL can a user make by default?

By default, PostgreSQL supports 115 concurrent connections, 15 for superusers and 100 connections for other users. However, sometimes you may need to increase max connections in PostgreSQL to support greater concurrency.


1 Answers

Whilst connected to the database you want to get this information

SELECT rolname, rolconnlimit FROM pg_roles WHERE rolconnlimit <> -1; 

More details are available at http://www.postgresql.org/docs/current/static/view-pg-roles.html

like image 124
DrColossos Avatar answered Oct 31 '22 18:10

DrColossos