Learn how to identify blocking queries in PostgreSQL with this quick YouTube tutorial. Master the art of pinpointing and resolving blocking issues for optimal database performance!
to identify blocking query;
SELECT bl.pid AS blocked_pid,
a.usename AS blocked_user,
ka.query AS blocking_statement,
now() - ka.query_start AS blocking_duration,
kl.pid AS blocking_pid,
ka.usename AS blocking_user,
a.query AS blocked_statement,
now() - a.query_start AS blocked_duration
FROM pg_catalog.pg_locks bl
JOIN pg_catalog.pg_stat_activity a ON a.pid = bl.pid
JOIN pg_catalog.pg_locks kl ON kl.transactionid = bl.transactionid AND kl.pid != bl.pid
JOIN pg_catalog.pg_stat_activity ka ON ka.pid = kl.pid
WHERE NOT bl.granted;
to identify currently running queries
#performance #dbs #longrunning #queries
Watch video PT-04 How to Identify blocking queries in postgresql | Tribute to online without registration, duration hours minute second in high quality. This video was added by user mynotesoracledba 27 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 306 once and liked it 14 people.