DBA Hub

📋Steps in this guide1/1

Kill a session in postgres

-- First find the pid of the session:

postgresql configurationintermediate
by PostgreSQL
12 views
1

Kill a session in postgres

Code/Command (click line numbers to comment):

1
2
3
4
5
6
-- First find the pid of the session:
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 kill that particular session..>>
dbaclass#
select pg_terminate_backend(pid) from pg_stat_activity where pid='1123';

Comments (0)

Please to add comments

No comments yet. Be the first to comment!