How to List Active Connections on PostgreSQL
How to List Active Connections on PostgreSQL
October 17, 2023
From https://stackoverflow.com/questions/27435839/how-to-list-active-connections-on-postgresql
SELECT
pid
,datname
,usename
,application_name
,client_hostname
,client_port
,backend_start
,query_start
,query
,state
FROM pg_stat_activity
WHERE state = 'active';
If you want to know the idle ones, use idle
.