SELECT * FROM pg_stat_activity;

select pg_terminate_backend(pid) from pg_stat_activity where datname='数据库名称';