Monitoring Connections

From: "Aaron Bono" <postgresql(at)aranya(dot)com>
To: "pgsql admin" <pgsql-admin(at)postgresql(dot)org>
Subject: Monitoring Connections
Date: 2006-09-20 17:48:03
Message-ID: bf05e51c0609201048o29f69ab9p5563870ef16763c7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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
==================================================================

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tomeh, Husam 2006-09-20 18:21:57 Re: Monitoring Connections
Previous Message Chris Mair 2006-09-20 17:02:40 Re: how to check the creation date of a postgres database?