Skip to content

Instantly share code, notes, and snippets.

@atiq1589
Last active March 14, 2018 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atiq1589/12fb5968a224099dadbeae335f3fbf5c to your computer and use it in GitHub Desktop.
Save atiq1589/12fb5968a224099dadbeae335f3fbf5c to your computer and use it in GitHub Desktop.
How to stop/kill a query in postgresql
-- To check the active activity
select * from pg_stat_activity where state = 'active';
-- To cancle an activity
select pg_cancel_backend(<pid of the process>)
-- To Terminate an activity
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