On Fri, Sep 23, 2011 at 13:34, Gregg Jaskiewicz <gryzman@gmail.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