每天学习一点点 编程PDF电子书、视频教程免费下载:
http://www.shitanlife.com/code

pgsql SQL监控,查询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;

  

posted @ 2019-10-30 15:23  漫步CODE人生  阅读(...)  评论(...编辑  收藏
每天学习一点点 编程PDF电子书、视频教程免费下载:
http://www.shitanlife.com/code