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 3E6FA9FA3A3 for ; Wed, 20 Sep 2006 15:46:12 -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 47592-03 for ; Wed, 20 Sep 2006 18:46:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by postgresql.org (Postfix) with ESMTP id A794C9FA0CC for ; Wed, 20 Sep 2006 15:46:02 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d42so349001pyd for ; Wed, 20 Sep 2006 11:46:00 -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:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=NaBZlFdrX2MhNbh2Z24hKFnOFZzsXgo0qtgLuuORrl4Mvs/n7vqR8d7xWx+6YMjjHA9N8Ue6X6SB9VhJ1EhUqq+8S8vGbO19PSz6yAOL2SmwBWYvHm0JLEAgaMMcd3i4jdHojkBVL2x/XihtRsxgfBqCGC7rJV6IvKUBr9Yinmo= Received: by 10.35.96.11 with SMTP id y11mr29699899pyl; Wed, 20 Sep 2006 11:46:00 -0700 (PDT) Received: by 10.35.80.9 with HTTP; Wed, 20 Sep 2006 11:46:00 -0700 (PDT) Message-ID: Date: Wed, 20 Sep 2006 13:46:00 -0500 From: "Aaron Bono" To: "Tomeh, Husam" Subject: Re: Monitoring Connections Cc: "pgsql admin" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_14128_26013126.1158777960160" References: X-Google-Sender-Auth: 840a3d2ef73d61f1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.334 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_50_60, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/219 X-Sequence-Number: 23133 ------=_Part_14128_26013126.1158777960160 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/20/06, Tomeh, Husam wrote: > > Make that: http://www.postgresql.org/docs/8.1/static/monitoring.html > 8.1 docs rather.. :) > > -- > Husam > http://firstdba.googlepages.com > > ------------------------------ > *From:* pgsql-admin-owner@postgresql.org [mailto: > pgsql-admin-owner@postgresql.org] *On Behalf Of *Tomeh, Husam > *Sent:* Wednesday, September 20, 2006 11:22 AM > *To:* Aaron Bono; pgsql admin > *Subject:* Re: [ADMIN] Monitoring Connections > > Query the pg_stat_activity. > For more detailed stats activities, you may query the pg_stat_* and > pg_statio_* system views. > > http://www.postgresql.org/docs/8.0/static/monitoring.html > > -- > Husam > http://firstdba.googlepages.com > > > ------------------------------ > *From:* pgsql-admin-owner@postgresql.org [mailto: > pgsql-admin-owner@postgresql.org] *On Behalf Of *Aaron Bono > *Sent:* Wednesday, September 20, 2006 10:48 AM > *To:* pgsql admin > *Subject:* [ADMIN] Monitoring Connections > > 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! > I checked the pg_stat_activity table and it doesn't give any more information than I got from the ps command. Is there any way to find out the last time the connection was used? Thanks, Aaron ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_14128_26013126.1158777960160 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/20/06, Tomeh, Husam <htomeh@firstam.com> wrote:
Make that:  http://www.postgresql.org/docs/8.1/static/monitoring.html    8.1 docs rather..   :)
 
--
  Husam


From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Tomeh, Husam
Sent: Wednesday, September 20, 2006 11:22 AM
To: Aaron Bono; pgsql admin
Subject: Re: [ADMIN] Monitoring Connections

Query the pg_stat_activity.
For more detailed stats activities, you may query the pg_stat_* and pg_statio_*  system views.
 
 
--
  Husam
 


From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Aaron Bono
Sent: Wednesday, September 20, 2006 10:48 AM
To: pgsql admin
Subject: [ADMIN] Monitoring Connections

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!

 
I checked the pg_stat_activity table and it doesn't give any more information than I got from the ps command.

Is there any way to find out the last time the connection was used?

Thanks,
Aaron

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