pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Finding number of current connections
2+ messages / 2 participants
[nested] [flat]

* Finding number of current connections
@ 2001-07-31 19:24 Tauren Mills <tauren@servlets.net>
  2001-08-09 16:37 ` Re: Finding number of current connections Tony Reina <reina@nsi.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Tauren Mills @ 2001-07-31 19:24 UTC (permalink / raw)
  To: pgsql-admin

I need to find a way to determine how many concurrent connections are being
made to the database server at any given time.  I'm coming from
administering a MySQL database and am familiar with the following command:

mysqladmin -uroot -p processlist

This lists something like this:

+-----+------+-----------+----+---------+------+------------------+
| Id  | User | Host      | db | Command | Time | Info             |
+-----+------+-----------+----+---------+------+------------------+
| 307 | root | localhost |    | Sleep   | 0    |                  |
| 308 | root | localhost |    | Sleep   | 0    |                  |
| 309 | root | localhost |    | Query   | 0    | show processlist |
+-----+------+-----------+----+---------+------+------------------+

User's on the system can also get a listing of only their own process list
and not see anyone else's processes by simply using their own username and
password.

I've looked through the FAQ and manual, but have not been able to find an
answer to this.  Is there some pgsql command that will provide this
information.  I need both a Full Listing from an administrative viewpoint
and a Per User listing.

If there is not a tool to do this, how difficult would it be to build a tool
to obtain this information?  Or is there simply no way to extract this
information from pgsql?

Thanks!
Tauren




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Finding number of current connections
  2001-07-31 19:24 Finding number of current connections Tauren Mills <tauren@servlets.net>
@ 2001-08-09 16:37 ` Tony Reina <reina@nsi.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: reina@nsi.edu @ 2001-08-09 16:37 UTC (permalink / raw)
  To: pgsql-admin

tauren@servlets.net ("Tauren Mills") wrote in message news:<NBBBLBKDJMGDNPMDGAABAEBKBBAB.tauren@servlets.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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-08-09 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-31 19:24 Finding number of current connections Tauren Mills <tauren@servlets.net>
2001-08-09 16:37 ` Tony Reina <reina@nsi.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox