Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 9EDBA1DA4C1F for ; Tue, 17 Jan 2012 13:18:55 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RnCgN-0007hv-IT for pgsql-admin@postgresql.org; Tue, 17 Jan 2012 17:18:55 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q0HHIb4g020245; Tue, 17 Jan 2012 12:18:37 -0500 (EST) To: "Kevin Grittner" cc: "=?ISO-8859-15?Q?Mindaugas=20=B4ak=A8auskas?=" , pgsql-admin@postgresql.org Subject: Re: Establishing remote connections is slow In-reply-to: <4F15517F0200002500044874@gw.wicourts.gov> References: <4F15517F0200002500044874@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Tue, 17 Jan 2012 10:46:23 -0600" Date: Tue, 17 Jan 2012 12:18:37 -0500 Message-ID: <20244.1326820717@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/67 X-Sequence-Number: 38979 "Kevin Grittner" writes: > Mindaugas Žakšauskas wrote: >> The essence is that establishing remote connection takes anywhere >> from 10 to 30 seconds. Once connected, the queries are fast > The only time I've seen something similar, there was no reverse DNS > entry to go from IP address to host name. Adding that corrected the > issue. I would try that. > If that fixes it, the questions would be whether PostgreSQL is doing > an unnecessary reverse DNS lookup. Having log_hostname off is supposed to prevent us from attempting a reverse DNS lookup ... but it would be worth checking into whether one is happening anyway. (I would think though that such activity would be visible in strace/truss output. Perhaps you should turn log_hostname *on* and verify that you see the lookup activity in strace that wasn't there before.) regards, tom lane