Skip to content

Instantly share code, notes, and snippets.

@YanhaoYang
Created December 18, 2013 09:36
Show Gist options
  • Save YanhaoYang/8019682 to your computer and use it in GitHub Desktop.
Save YanhaoYang/8019682 to your computer and use it in GitHub Desktop.
PostgreSLQ connections
  • Show active connections

    • SELECT * FROM pg_stat_activity;
    • ps aux | grep postgres | wc -l (roughly, when you cannot connect to it)
  • Show @max_connections@

    • In psql: SHOW max_connections; (SHOW ALL;)
    • SQL: SELECT * FROM pg_settings WHERE name = 'max_connections';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment