DBA Hub

📋Steps in this guide1/1

Find blocking sessions in postgres

-- QUERY TO FIND BLOCKING SESSION DETAILS

postgresql configurationintermediate
by PostgreSQL
16 views
1

Find blocking sessions in postgres

-- QUERY TO FIND BLOCKING SESSION DETAILS output:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
dbaclass#
select pid as blocked_pid, usename, pg_blocking_pids(pid) as "blocked_by(pid)",
query as blocked_query from pg_stat_activity where cardinality(pg_blocking_pids(pid)) > 0;
blocked_pid | usename  | blocked_by(pid) |        blocked_query
-------------+----------+-------------+------------------------------
4206 | postgres | {3673}      | alter table test drop query;

Comments (0)

Please to add comments

No comments yet. Be the first to comment!