Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 4D95BB5DC04 for ; Wed, 24 Aug 2011 12:33:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 40545-03 for ; Wed, 24 Aug 2011 15:33:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mail.postgresql.org (Postfix) with ESMTP id A700BB5DC3D for ; Wed, 24 Aug 2011 12:33:26 -0300 (ADT) Received: from [192.168.1.7] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0MNtut-1QuIaO2YVX-007YYD; Wed, 24 Aug 2011 17:33:24 +0200 Message-ID: <4E5519C2.7030607@2ndQuadrant.com> Date: Wed, 24 Aug 2011 11:33:22 -0400 From: Greg Smith User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110702 Icedove/3.0.11 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: How to track number of connections and hosts to Postgres cluster References: <1314172144.2193.9.camel@localhost.localdomain> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:eDZWmuwY8W/qra76KRwfEAMWtVnAnszyP5d8HwpZttM 81PNc+jfgrE1Xk6mjlopYUF8IhhYbML7IRkAbBt9Gkb/RVvcMh Z35AIBHAbEkAkiQsY2h0Kpa9KGM9cUhXZVjE5p7Db5YrRo10si oMEk/leNNniv7hEjomHb+Y+SbIuOWc+BvYNyo+ptDPwznTgp9V RfIdjUGtMGUOdQo0CdiMjYcWDQ0jS6JyRprORhnzoo= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201108/266 X-Sequence-Number: 44713 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