Skip to content

Instantly share code, notes, and snippets.

@alonisser
Last active November 27, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alonisser/470b11fdda67e25e764f to your computer and use it in GitHub Desktop.
Save alonisser/470b11fdda67e25e764f to your computer and use it in GitHub Desktop.
Finding the postgres connections hog
#Broken somehow. need to fix
SELECT COUNT(*) as datname, datname, datid FROM pg_stat_activity GROUP BY datname;
#Works without id
SELECT COUNT(*) as datname, datname FROM pg_stat_activity GROUP BY datname;
More info:
http://chrismiles.info/systemsadmin/databases/articles/viewing-current-postgresql-queries/
https://support.pivotal.io/hc/en-us/articles/201595093-Script-Session-level-information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment