Created
March 13, 2018 21:53
-
-
Save waltton/fdc485ff62a8b24be183a15e2624f4a7 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
watch -n 5 'psql -U postgres -h HOST DATABASE -c "select pg_class.relname, count(*), SUM(now() - pg_stat_activity.query_start) from pg_catalog.pg_locks JOIN pg_catalog.pg_stat_activity ON pg_stat_activity.pid = pg_locks.pid JOIN pg_class ON pg_class.oid = pg_locks.relation GROUP BY pg_class.relname ORDER BY SUM(now() - pg_stat_activity.query_start) DESC;"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment