X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id B71199FB296 for ; Wed, 20 Sep 2006 14:48:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 87598-05 for ; Wed, 20 Sep 2006 17:48:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by postgresql.org (Postfix) with ESMTP id 41D039FA612 for ; Wed, 20 Sep 2006 14:48:06 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so433258pyd for ; Wed, 20 Sep 2006 10:48:04 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=Ypmb3zmXYSJJusza/V1fxAsORfdLUaalPFl3/uvB4tjksx/oW7rHv0aeATzPGEOfiZihUi6RW/cJyKbOlNSGPxqhu2cipcs4wNvOtMBG7+d6SPqq9oEKD/ahmB9JcawVb4xI5ThpbR0+2cw1Et6u+waLDSnPkQ1iCMF2F+/AyuU= Received: by 10.35.27.1 with SMTP id e1mr28967445pyj; Wed, 20 Sep 2006 10:48:03 -0700 (PDT) Received: by 10.35.80.9 with HTTP; Wed, 20 Sep 2006 10:48:03 -0700 (PDT) Message-ID: Date: Wed, 20 Sep 2006 12:48:03 -0500 From: "Aaron Bono" To: "pgsql admin" Subject: Monitoring Connections MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12963_31228008.1158774483414" X-Google-Sender-Auth: 4b7c00bacc970f99 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.551 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_10_20, HTML_MESSAGE, SPF_PASS X-Spam-Level: * X-Archive-Number: 200609/216 X-Sequence-Number: 23130 ------=_Part_12963_31228008.1158774483414 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Is there a way to get diagnostics on current connections to the database? Specifically I am looking for: 1. How many current connections are there? 2. Who is connected (user name, database and from what IP address)? 3. When was the last time the connection was used? 4. When was the connection established? I can get most of this information from the ps command but am having problem with getting the information on #3. My problem is that I have a number of web sites running on the server all using different databases and/or user log ins and also using connection pooling. Whenever I redeploy an application, the "old" connections do not appear to disconnect but new connections are established. I fear that, since the application server is not actually restarting but just reloading the application, it is keeping old connections open when they really should be closed. This is something I will need to fix in the application but I need to do some digging before I know this is indeed the problem. I am using PostgreSQL 8.1.3 on CentOS. Thanks! -- ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_12963_31228008.1158774483414 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Is there a way to get diagnostics on current connections to the database?  Specifically I am looking for:

1. How many current connections are there?
2. Who is connected (user name, database and from what IP address)?
3. When was the last time the connection was used?
4. When was the connection established?

I can get most of this information from the ps command but am having problem with getting the information on #3.

My problem is that I have a number of web sites running on the server all using different databases and/or user log ins and also using connection pooling.  Whenever I redeploy an application, the "old" connections do not appear to disconnect but new connections are established.  I fear that, since the application server is not actually restarting but just reloading the application, it is keeping old connections open when they really should be closed.  This is something I will need to fix in the application but I need to do some digging before I know this is indeed the problem.

I am using PostgreSQL 8.1.3 on CentOS.

Thanks!

--
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_12963_31228008.1158774483414--