铁雪资源网 Design By www.gsvan.com
查看任务sql语句:
SELECT procpid, start, now() - start AS lap, current_query FROM (SELECT backendid, pg_stat_get_backend_pid(S.backendid) AS procpid, pg_stat_get_backend_activity_start(S.backendid) AS start, pg_stat_get_backend_activity(S.backendid) AS current_query FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS S ) AS S WHERE current_query <> '<IDLE>' ORDER BY lap DESC;
其中
procpid:进程id
start:进程开始时间
lap:经过时间
current_query:执行中的sql
强制停止某一个任务:
SELECT pg_cancel_backend(进程id);
补充:
SELECT pid, datname AS db, query_start AS start, now() - query_start AS lap, query FROM pg_stat_activity WHERE state <> 'idle' and query not like '%pg_stat_activity%' and (now() - query_start) > interval '10 seconds';
铁雪资源网 Design By www.gsvan.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
铁雪资源网 Design By www.gsvan.com
暂无PostgreSQL查看正在执行的任务并强制结束的操作方法的评论...