SELECT datname, usename, COUNT(*) AS connection_count , client_addr, COUNT(*) AS connection_count
FROM pg_stat_activity
GROUP BY datname, usename, client_addr;
SELECT datname, usename, COUNT(*) AS connection_count , client_addr, COUNT(*) AS connection_count
FROM pg_stat_activity
GROUP BY datname, usename, client_addr;