pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndQuadrant.com>
To: pgsql-performance@postgresql.org
Subject: Re: How to track number of connections and hosts to Postgres cluster
Date: Wed, 24 Aug 2011 11:33:22 -0400
Message-ID: <4E5519C2.7030607@2ndQuadrant.com> (raw)
In-Reply-To: <CAFrxt0iiQO8bBryOXRiCcW-U6NrdJepLZ_ZRXV4d+RhZziWbcA@mail.gmail.com>
References: <CAFrxt0gk66pDOuEjB9oQJ=b1VYAeiiNDgEaFz99RhVxrecWsMg@mail.gmail.com>
	<1314172144.2193.9.camel@localhost.localdomain>
	<CAFrxt0iiQO8bBryOXRiCcW-U6NrdJepLZ_ZRXV4d+RhZziWbcA@mail.gmail.com>

On 08/24/2011 07:07 AM, Venkat Balaji wrote:
> But, if put log_connections to on and log_disconnections to on 
> wouldn't the Postgres be logging in lot of data ?
> Will this not be IO intensive ? I understand that this is the best 
> way, but, would want to know if there is an other way to reduce IO ( 
> may be through queries to catalog tables ).
>

Your requirements include:  " I need all the host IPs making a 
connection to Postgres Cluster (even for a fraction of second)."

The only way to do this is to log every connection.  Any other approach 
for grabbing the data, such as looking at pg_stat_activity, will 
sometimes miss one.

If you're willing to lose a connection sometimes, a cron job that polls 
pg_stat_activity and saves a summary of what it finds will normally use 
less resources.  But connections that start and end between runs will be 
missed.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us




view thread (17+ messages)  latest in thread

Message-ID: <4E5519C2.7030607@2ndQuadrant.com>
Permalink:  ../4E5519C2.7030607@2ndQuadrant.com/
Also on:    postgresql.org/message-id/4E5519C2.7030607@2ndQuadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: greg@2ndQuadrant.com
  Subject: Re: How to track number of connections and hosts to Postgres cluster
  In-Reply-To: <4E5519C2.7030607@2ndQuadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox