NikolayS / postgres_dba

The missing set of useful tools for Postgres DBAs and all engineers
BSD 3-Clause "New" or "Revised" License
1.03k stars 113 forks source link

Feature request active and idle in transaction query #49

Open oleg9301 opened 3 years ago

oleg9301 commented 3 years ago

It's good to have query to see active and idle in transaction query I propose to make "a2" with next query:

SELECT pid, client_addr, now() - query_start as "runtime", usename, datname, state, query FROM pg_stat_activity WHERE now() - query_start > '30 seconds'::interval and state != 'idle' ORDER BY runtime DESC;