Re: Finding number of current connections

From: reina(at)nsi(dot)edu (Tony Reina)
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Finding number of current connections
Date: 2001-08-09 16:37:53
Message-ID: f40d3195.0108090837.4d317746@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

tauren(at)servlets(dot)net ("Tauren Mills") wrote in message news:<NBBBLBKDJMGDNPMDGAABAEBKBBAB(dot)tauren(at)servlets(dot)net>...
> I need to find a way to determine how many concurrent connections are being
> made to the database server at any given time.

You may find what you are looking for with Bruce Momjian's pgmonitor
tool.

http://greatbridge.org/project/pgmonitor/projdisplay.php

Alternatively, you could just use a simple shell script. All of the
Postgres connections are separate jobs with the identifier "postgres:"
at the begining. So you could simply do:

ps ax | grep postgres:

on a RH Linux machine.

With some sed/awk commands, you could sort the job information even
finer. For example, to find out which users are logged onto the
database at any given time:

ps ax | grep postgres: | awk '{print $6 | "sort" } ' | uniq

I'm sure if you fooled around with this, you could come up with
something tailored to your needs in no time.

-Tony

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Crowe, Simon 2001-08-09 17:43:40 Postgress Unicode Support
Previous Message Gary Stainburn 2001-08-09 08:29:41 Re: upgrading RPM query