Re: get number and names of processes connected to postgresql

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: get number and names of processes connected to postgresql
Дата
Msg-id CABRT9RAhkBNppZUK7yCQqQSdEezTY73H4D3xzjciaaKB4kM=aw@mail.gmail.com
обсуждение исходный текст
Ответ на get number and names of processes connected to postgresql  (Gregg Jaskiewicz <gryzman@gmail.com>)
Ответы Re: get number and names of processes connected to postgresql
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Eduardo Morras
Дата:
Сообщение: Re: looking for a faster way to do that
Следующее
От: Roger Niederland
Дата:
Сообщение: Re: pg_dump compress