postgres long active activity code example Example: check connections to database postgres SELECT * FROM pg_stat_activity WHERE datname='db_name';