Home > Database > Mysql Tutorial > PostgreSQL 列举和停止执行中的 sql

PostgreSQL 列举和停止执行中的 sql

WBOY
Release: 2016-06-07 14:54:52
Original
1291 people have browsed it

procpid:进程id start:进程开始时间 lap:经过时间 current_query:执行中的sql 怎样停止正在执行的sql SELECT pg_cancel_backend(进程id); 或者用系统函数 kill -9 进程id; PostgreSQL SELECT procpid, start, now() - start AS lap, current_query FROM

procpid:进程id
start:进程开始时间
lap:经过时间
current_query:执行中的sql

怎样停止正在执行的sql
SELECT pg_cancel_backend(进程id);

或者用系统函数

kill -9 进程id;

PostgreSQL
    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;  
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template