postgres active connections code example
Example 1: psql connections
SELECT * FROM pg_stat_activity;
Example 2: postgres active connections
SELECT * FROM pg_stat_activity;
OR
SELECT datid, datname, pid, usename, state, query FROM pg_stat_activity;