Skip to main content

Terminate postgres active connection

Open Terminal and run this command


PGPASSWORD=password psql -U username -d name_of_database -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'name_of_database' AND pid <> pg_backend_pid();"

Comments

Popular posts from this blog

Resolve OpenSSL::SSL::SSLError on Yosemite

If you are using rvm installed ruby on Yosemite  OSX  and getting error : OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed then reinstalling ruby with ` --disable-binary` may fix this Issue. rvm reinstall 2.1.2 --disable-binary  Reason: Ruby installed with packaged binary in rvm has OpenSSL path: /etc/openssl  Path of installed openssl is :  /usr/local/etc/openssl To check openssl directory: > irb > require 'openssl' > "SSL_CERT_DIR: %s" % OpenSSL::X509::DEFAULT_CERT_DIR

Software Engineering Vs Programming

When I was growing up,   Software Engineer and Programmer seems same term to me. Now after working a couple of years as a Software Engineer I think I can distinguish between the two terms.  Programming is a small part of Software Engineering.  Software Engineering include Understanding Requirement  Designing Software Organising code  Testing Software  Collaborating with other software engineers Writing good code is essential skill for being a Good software engineer but you can not neglect others skills as they are equally important for building good product. I read something similar in Software Engineering subject during my graduation, but none of the above make sense than. I think reading about software engineering is not the great way to learn about it instead build a lots of software and you will get a grasp of software engineering. What text books do not tell you about Software Engineering is : U...

Letter To Ruby Conf India Organisers

Disclaimer : This article consist of my brutally honest review about Ruby Conf India 2015, If you are prone to depression, heart attack while reading criticism, please STOP reading this letter now  and move on. I know organizers worked hard to organize this event and I thank you for that but this does not mean I am happy with the way it was organised. I have complaints, so do lots of people I know. Someone has to raise voice, for now I am taking this responsibility. 1. Why Discriminate ? I was given accommodation in Justa-panjim while most of the conf attendees were in Cidade-goa, those two hotel are incomparable. Justa-panjim didn't have enough water for bathing, forget about swimming pool, beach. I didn't had complained if everyone was given accommodation in Justa-panjim, Yes I am being jealous here..!!! I paid conf fees(lite tickets.. yes thats how early I booked my ticket.) and I deserve to be treated equally , why discriminate ? 2. Where's Ruby ? In some o...