Re: How to track number of connections and hosts to Postgres cluster

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: How to track number of connections and hosts to Postgres cluster
Дата
Msg-id 1314172144.2193.9.camel@localhost.localdomain
обсуждение исходный текст
Ответ на How to track number of connections and hosts to Postgres cluster  (Venkat Balaji <venkat.balaji@verse.in>)
Ответы Re: How to track number of connections and hosts to Postgres cluster  (Venkat Balaji <venkat.balaji@verse.in>)
Список pgsql-performance
On Wed, 2011-08-24 at 13:05 +0530, Venkat Balaji wrote:
> Hello Everyone,
>
> I am working on an alert script to track the number of connections with the
> host IPs to the Postgres cluster.
>
> 1. I need all the host IPs making a connection to Postgres Cluster (even for
> a fraction of second).

You should set log_connections to on.

> 2. I would also want to track number of IDLE connections, IDLE IN
> TRANSACTION connections and length of the connections as well.
>

IDLE and IDLE in transactions are the kind of informations you get in
pg_stat_activity.

Length of connections, you can get it with log_disconnections.

> I would be making use of pg_stat_activity and also thought of enabling
> logging the host ips in the db server log files which seems to be expensive
> for me (in terms of IO and logfile size).
>

Using pg_stat_activity won't get you really small connections. You need
log_connections for that, and log_disconnections for the duration of
connections. So you'll have to work on a tool that could get some
informations with queries on pg_stat_activity, and that could read
PostgreSQL log files.


--
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com


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

Предыдущее
От: Venkat Balaji
Дата:
Сообщение: How to track number of connections and hosts to Postgres cluster
Следующее
От: Venkat Balaji
Дата:
Сообщение: Re: How to track number of connections and hosts to Postgres cluster