DBA Hub

📋Steps in this guide1/1

Cancel a session in postgres

-- First find the pid of the session:

postgresql configurationintermediate
by PostgreSQL
13 views
1

Cancel a session in postgres

-- First find the pid of the session:

Code/Command (click line numbers to comment):

1
2
3
4
5
dbaclass#
SELECT datname as database, pid as pid, usename as username, application_name , client_addr , query FROM pg_stat_activity;
<< Lets say the pid=1124, in the below query pass the pid value to cancel that particular session query>>
dbaclass#
select pg_cancel_backend(pid) from pg_stat_activity where pid='1124';

Comments (0)

Please to add comments

No comments yet. Be the first to comment!