Kill a postgresql session/connection
You can use pg_terminate_backend() to kill a connection. You have to be superuser to use this function. This works on all operating systems the same. SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE — don’t kill my own connection! pid <> pg_backend_pid() — don’t kill the connections to other databases AND datname=”database_name” ; Before executing this query, you … Read more