Skip to content

Instantly share code, notes, and snippets.

@pfigue
Last active August 29, 2015 14:15
Show Gist options
  • Save pfigue/b6b3f9be54d535141792 to your computer and use it in GitHub Desktop.
Save pfigue/b6b3f9be54d535141792 to your computer and use it in GitHub Desktop.
PostgreSQL cheatsheet

Show active and idle connections grouped by state and client address for all the databases in the server:

SELECT count(datid), state, client_addr FROM pg_stat_activity group by state, client_addr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment