Created
June 7, 2023 09:22
-
-
Save hipertracker/412cbea4a0a7260270e02a87ec3f1b11 to your computer and use it in GitHub Desktop.
Postgres query showing all pending queries
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 | |
usename, | |
pid, | |
client_addr, | |
STATE, | |
age( clock_timestamp(), query_start ), | |
query, | |
query_start, | |
wait_event_type, | |
wait_event, | |
pg_blocking_pids(pid) AS blocked_by_pids | |
FROM | |
pg_stat_activity | |
WHERE | |
query != '<IDLE>' | |
AND STATE != 'idle' | |
AND query NOT ILIKE'%pg_stat_activity%' | |
AND query_start IS NOT NULL | |
ORDER BY | |
query_start DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment