how to check all connections to database in postgres code example Example: check connections to database postgres SELECT * FROM pg_stat_activity WHERE datname='db_name';