Skip to content

Latest commit

 

History

History
14 lines (13 loc) · 285 Bytes

kill-connection.md

File metadata and controls

14 lines (13 loc) · 285 Bytes
SELECT
    pg_terminate_backend(pid)
FROM
    pg_stat_activity
WHERE
    -- don't kill my own connection!
    pid <> pg_backend_pid()
    -- don't kill the connections to other databases
    AND datname = 'database_name'
    ;

Source