在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
查看任务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 强制停止某一个任务: 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'; 到此这篇关于PostgreSQL查看正在执行的任务并强制结束的文章就介绍到这了,更多相关PostgreSQL查看正在执行内容请搜索极客世界以前的文章或继续浏览下面的相关文章希望大家以后多多支持极客世界! |
请发表评论