Re: Finding number of current connections - Mailing list pgsql-general

From Jan Wieck
Subject Re: Finding number of current connections
Date
Msg-id 200108011151.f71BpUV01592@jupiter.us.greatbridge.com
Whole thread Raw
In response to Finding number of current connections  ("Tauren Mills" <tauren@servlets.net>)
List pgsql-general
Tauren Mills wrote:
> I posted this message to the admin list, but just realized maybe it belongs
> in the general list.  Sorry for double posting!
>
> 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 |
> +-----+------+-----------+----+---------+------+------------------+

    Among alot more statistics down to number of rows returned by
    scans, this will be added in v7.2:

        pgsql=# select * from pg_stat_database;
         datid |  datname  | numbackends | xact_commit | xact_rollback | blks_read | blks_hit
        -------+-----------+-------------+-------------+---------------+-----------+----------
             1 | template1 |           0 |           0 |             0 |         0 |        0
         19030 | template0 |           0 |           0 |             0 |         0 |        0
         19070 | pgsql     |           3 |           0 |             0 |         0 |        0
         19093 | wieck     |           0 |           0 |             0 |         0 |        0
        (4 rows)

        pgsql=# select * from pg_stat_activity;
         datid | datname | procpid | usesysid | usename | current_query
        -------+---------+---------+----------+---------+---------------
         19070 | pgsql   |    1576 |      501 | pgsql   |
         19070 | pgsql   |    1578 |      501 | pgsql   |
         19070 | pgsql   |    1580 |      501 | pgsql   |
        (3 rows)


    The numbers are mostly zero because I haven't  activated  the
    collection of statistics in the config file.

    Approximately what you're looking for?


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: creating postgres tables using existing table defs
Next
From: Jan Wieck
Date:
Subject: Re: Finding number of current connections