Last active
February 13, 2019 13:44
-
-
Save steklopod/a29a979de0f08a98e6befd96443a3a00 to your computer and use it in GitHub Desktop.
Kill SQL process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM pg_stat_activity | |
WHERE state = 'active'; | |
SELECT pg_terminate_backend(pid) | |
FROM pg_stat_activity | |
WHERE datname = 'payhub' | |
AND pid <> pg_backend_pid() | |
AND state in ('active'); | |
############################ | |
SELECT * FROM pg_stat_activity WHERE state = 'active'; | |
Find the process you want to kill, then type: | |
SELECT pg_cancel_backend(<pid of the process>) | |
If the process cannot be killed, try: | |
SELECT pg_terminate_backend(<pid of the process>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment