Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get connections stat in postgres #16

Open
lmquang opened this issue Feb 9, 2018 · 0 comments
Open

Get connections stat in postgres #16

lmquang opened this issue Feb 9, 2018 · 0 comments
Labels

Comments

@lmquang
Copy link
Owner

lmquang commented Feb 9, 2018

select max_conn,used,res_for_super,max_conn-used-res_for_super res_for_normal 
from 
  (select count(*) used from pg_stat_activity) t1,
  (select setting::int res_for_super from pg_settings where name=$$superuser_reserved_connections$$) t2,
  (select setting::int max_conn from pg_settings where name=$$max_connections$$) t3

https://dba.stackexchange.com/questions/161760/number-of-active-connections-and-remaining-connections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant