To close all existing connection to your database. We can pass the process/connection id to the predefined function pg_terminate_backend. Execute below query
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
-- exclude current connection window
pid <> pg_backend_pid()
AND datname = '<database name>'
Note: Database name is case sensitive
No comments:
Post a Comment