| From: | Marti Raudsepp <marti(at)juffo(dot)org> |
|---|---|
| To: | Gregg Jaskiewicz <gryzman(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: get number and names of processes connected to postgresql |
| Date: | 2011-09-24 15:30:11 |
| Message-ID: | CABRT9RAhkBNppZUK7yCQqQSdEezTY73H4D3xzjciaaKB4kM=aw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Fri, Sep 23, 2011 at 13:34, Gregg Jaskiewicz <gryzman(at)gmail(dot)com> wrote:
> Basically, I got bunch of local processes connecting to postgresql,
> need to aggregate some sort of report about number of connections and
> its origin every so often.
The pg_stat_activity system view gives you the database name (datname)
and user name (usename) they're connected with. client_addr tells you
what IP address they're connecting from.
Generally you would use different usernames and databases for
different applications, so that should give you a good enough picture?
You can even run aggregate queries over this view so such a report is
just a matter of writing SQL :)
PostgreSQL 9.0 also adds a "application_name" variable that each
connection can set that's visible in pg_stat_activity.
Regards,
Marti
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2011-09-24 18:23:57 | Re: Documentation of what schema modifications cause what level of table locking |
| Previous Message | Eduardo Morras | 2011-09-24 14:28:06 | Re: looking for a faster way to do that |