-
-
Save mtuckerb/1983ab3d057f6a890ce6d8a381269a7b to your computer and use it in GitHub Desktop.
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
def client(db_name = 'postgres') | |
PG::Connection.connect( port: 6432, user: 'postgres', dbname: 'postgres') | |
end | |
def client2(db_name = 'postgres') | |
PG::Connection.connect( port: 6432, user: 'postgres', dbname: 'postgres') | |
end | |
def client3(db_name = 'postgres') | |
PG::Connection.connect( port: 6432, user: 'postgres', dbname: 'postgres') | |
end | |
def client4(db_name = 'postgres') | |
PG::Connection.connect( port: 6432, user: 'postgres', dbname: 'postgres') | |
end | |
def client5(db_name = 'postgres') | |
PG::Connection.connect( port: 6432, user: 'postgres', dbname: 'postgres') | |
end | |
client.exec(" SELECT pg_database.datname FROM pg_database WHERE datistemplate = false") | |
client2.exec(" SELECT pg_database.datname FROM pg_database WHERE datistemplate = false") | |
client3.exec(" SELECT pg_database.datname FROM pg_database WHERE datistemplate = false") | |
client4.exec(" SELECT pg_database.datname FROM pg_database WHERE datistemplate = false") | |
c = client; c.close | |
c = client2; c.close | |
c= client3; c.close | |
c= client4; c.close |
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
select * from pg_stat_activity where datname = 'postgres' and (state='idle' or state='active') | |
> 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment