Created
August 30, 2018 22:40
-
-
Save jeffersonsouza/8cfbef0d04c3ea51feae14300d6a6008 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- Get active queries with duration greater than 1 sec | |
SELECT (now() - query_start) as duracao, pid, query, usename, datname | |
FROM pg_stat_activity | |
WHERE state = 'active' | |
AND query_start < now() - '1 seconds'::interval | |
AND pid <> pg_backend_pid() | |
ORDER BY query_start ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment