Last active
September 4, 2020 06:18
-
-
Save dslaw/7c8fea4cf5d50b6551c1701bf91d26aa to your computer and use it in GitHub Desktop.
Query Postgres activity
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 | |
datname, | |
state, | |
usename || ':' || application_name as user_app, | |
to_char(query_start, 'YYYY-MM-DD HH24:MI') as query_start, | |
to_char(age(now(), query_start), 'HH24:MI') as "age", | |
wait_event_type || ':' || wait_event as wait_event, | |
left(query, 50) as "query", | |
pid | |
from pg_stat_activity | |
where pid != pg_backend_pid() | |
order by datname, state, user_app, query_start; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment