List Connections To A Database
The pg_stat_activity
table can be used to determine what connections there currently are to the PostgreSQL server and to a particular database. To see the process ids and usernames of all connection to your PostgreSQL server, run the following query:
Include datname
in the requested columns to figure out the database of each connection.
The results can be restricted to a particular database as necessary.
Last updated