Created
September 4, 2012 17:37
-
-
Save mjallday/3623938 to your computer and use it in GitHub Desktop.
Slow transactions Postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select c.relname, | |
l.mode, | |
l.granted as "g", | |
a.current_query, | |
cast(a.query_start as time), | |
age(now(), a.query_start) as "age", | |
a.procpid, | |
a.client_addr | |
from pg_stat_activity a | |
inner join pg_locks l on a.procpid = l.pid | |
left outer join pg_class c on l.relation = c.oid | |
where age(now(), a.query_start) > interval '1 minutes' | |
order by a.query_start, l.pid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select c.relname, | |
l.mode, | |
l.granted as "g", | |
a.current_query, | |
cast(a.query_start as time), | |
age(now(), a.query_start) as "age", | |
a.procpid, | |
a.client_addr | |
from pg_stat_activity a | |
inner join pg_locks l on a.procpid = l.pid | |
left outer join pg_class c on l.relation = c.oid | |
where a.query_start < NOW() - interval '1 minutes' | |
order by a.query_start, l.pid; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment