\c postgres
SELECT *
FROM pg_stat_activity
WHERE datname = 'mydb';
Kill connections to database if you want:
SELECT
pg_terminate_backend (pid)
FROM
pg_stat_activity
WHERE
datname = 'mydb';
\c postgres
SELECT *
FROM pg_stat_activity
WHERE datname = 'mydb';
Kill connections to database if you want:
SELECT
pg_terminate_backend (pid)
FROM
pg_stat_activity
WHERE
datname = 'mydb';