Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 260A5632D2E for ; Sat, 10 Jul 2010 00:34:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 76713-01 for ; Sat, 10 Jul 2010 03:34:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.4.227.11]) by mail.postgresql.org (Postfix) with ESMTP id D85E4632A86 for ; Sat, 10 Jul 2010 00:34:02 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 725F779240; Sat, 10 Jul 2010 11:33:24 +0800 (WST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 9EFE0AF6FA; Sat, 10 Jul 2010 11:32:11 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IbsmRFZl4x3m; Sat, 10 Jul 2010 11:32:06 +0800 (WST) Received: from [10.1.1.3] (124-168-255-56.dyn.iinet.net.au [124.168.255.56]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 11176AF6F9; Sat, 10 Jul 2010 11:32:06 +0800 (WST) Message-ID: <4C37EA1D.6000008@postnewspapers.com.au> Date: Sat, 10 Jul 2010 11:33:49 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: Josh Berkus CC: Kevin Grittner , Greg Smith , Matthew Wakeling , Brad Nicholson , pgsql-performance@postgresql.org, Tom Lane Subject: Re: Pooling in Core WAS: Need help in performance tuning. References: <4C369346.6010501@postnewspapers.com.au> <8760.1278650566@sss.pgh.pa.us> <1278680186.1914.36.camel@bnicholson-desktop> <4C36F57102000025000332F6@gw.wicourts.gov> <4C36FEAD02000025000332FC@gw.wicourts.gov> <4C37A9C1.1060405@2ndquadrant.com> <4C37791C0200002500033379@gw.wicourts.gov> <4C37CBFB.1000800@agliodbs.com> In-Reply-To: <4C37CBFB.1000800@agliodbs.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/170 X-Sequence-Number: 39559 On 10/07/2010 9:25 AM, Josh Berkus wrote: > >> It *is* the last place you want to put it, but putting it there can >> be much better than not putting it *anywhere*, which is what we've >> often seen. > > Well, what you proposed is an admission control mechanism, which is > *different* from a connection pool, although the two overlap. A > connection pool solves 4 problems when it's working: > > a) limiting the number of database server processes > b) limiting the number of active concurrent queries > c) reducing response times for allocating a new connection > d) allowing management of connection routes to the database > (redirection, failover, etc.) I agree with you: for most Pg users (a) is really, really important. As you know, in PostgreSQL each connection maintains not only general connection state (GUC settings, etc) and if in a transaction, transaction state, but also a query executor (full backend). That gets nasty not only in memory use, but in impact on active query performance, as all those query executors have to participate in global signalling for lock management etc. So an in-server pool that solved (b) but not (a) would IMO not be particularly useful for the majority of users. That said, I don't think it follows that (a) cannot be solved in-core. How much architectural change would be required to do it efficiently enough, though... -- Craig Ringer