Last active
March 8, 2018 19:47
-
-
Save ritec/6a8031fb27ea8bf8561eec8c00db8037 to your computer and use it in GitHub Desktop.
usefulPostgresInfo.sql
This file contains hidden or 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
# Get a DB Console. | |
bundle exec rails dbconsole | |
# Get number of Connections / Used and left | |
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 | |
; | |
# Restart Postgres | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log restart | |
# Postgres Config Location in OSX | |
/usr/local/var/postgres/postgresql.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment