This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a script to find long running queries or sessions with the lock information of Greenplum database server.
In the below script, you can find the age column which gives you total execution time of running sessions. You can also find query lock related details.
1 2 3 4 5 6 7 8 9 10 11 12 |
select age(now(),pg_stat_activity.query_start) as "age", pg_stat_activity.datname, pg_stat_activity.usename, pg_stat_activity.client_addr, pg_stat_activity.application_name, pg_locks.transactionid, pg_locks.transaction, pg_stat_activity.procpid, pg_stat_activity.query_start, pg_locks.mode, pg_stat_activity.current_query from pg_stat_activity, pg_locks where pg_locks.pid = pg_stat_activity.procpid and procpid <> pg_backend_pid() and pg_locks.transactionid = pg_locks.transaction order by 1 desc; |
Leave a Reply