Created
August 3, 2023 12:25
-
-
Save marcosgz/26fb67857fe3da35748044a2f940f08f to your computer and use it in GitHub Desktop.
View active queries in 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 | |
pid, | |
now() - pg_stat_activity.query_start AS duration, | |
query, | |
state | |
FROM pg_stat_activity | |
WHERE (now() - pg_stat_activity.query_start) > interval '1 minutes' and state<>'idle' | |
order by pg_stat_activity.query_start desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment