1/* view connections */
2SELECT * FROM pg_stat_activity;
3
4/*-— Kill connections*/
5SELECT
6 pg_terminate_backend(pid)
7FROM
8 pg_stat_activity
9WHERE
10 -- don't kill my own connection!
11 pid != pg_backend_pid()
12 -- don't kill the connections to other databases
13 AND datname = 'clinical_data';
14
15/* kill a specific connection */
16select pg_terminate_backend(13337)