Created
December 9, 2019 16:37
-
-
Save ralexx/5ac45775e5a483b30c7813b17197c8d7 to your computer and use it in GitHub Desktop.
Postgresql available connections
This file contains 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
-- https://dba.stackexchange.com/a/161761 | |
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment