-- 所有执行sql
SELECT sa.* FROM pg_catalog.pg_stat_activity sa;

-- 事务
SELECT
(SELECT sum(xact_commit) + sum(xact_rollback) AS "Total" FROM pg_stat_database),
(SELECT sum(xact_commit) AS "Commit" FROM pg_stat_database),
(SELECT sum(xact_rollback) AS "Rollback" FROM pg_stat_database)

查询并杀掉某个表的正在执行的sql进程并杀掉

select
pg_terminate_backend(pid),
query
from
pg_stat_activity
where
query ~* 'ipmp_home_page_status_image'
and pid <> pg_backend_pid();