Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 11DF7632CCF for ; Wed, 28 Jul 2010 02:09:53 -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 75894-04 for ; Wed, 28 Jul 2010 05:09:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 04C4B632C51 for ; Wed, 28 Jul 2010 02:09:44 -0300 (ADT) 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 o6S59Y4A003775; Wed, 28 Jul 2010 01:09:34 -0400 (EDT) To: Robert Haas cc: Andres Freund , Craig Ringer , Matthew Wakeling , pgsql-performance@postgresql.org Subject: Re: Pooling in Core WAS: Need help in performance tuning. In-reply-to: References: <4C37A9C1.1060405@2ndquadrant.com> <4C37791C0200002500033379@gw.wicourts.gov> <4C37CBFB.1000800@agliodbs.com> <4C37EA1D.6000008@postnewspapers.com.au> <4C38BF03.6060503@agliodbs.com> <19244.1278787866@sss.pgh.pa.us> <4C3AF564.5030204@postnewspapers.com.au> <20100722212954.GA16758@anarazel.de> <13654.1280263202@sss.pgh.pa.us> <20776.1280282217@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Tue, 27 Jul 2010 22:05:34 -0400" Date: Wed, 28 Jul 2010 01:09:34 -0400 Message-ID: <3774.1280293774@sss.pgh.pa.us> From: Tom Lane 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/426 X-Sequence-Number: 39815 Robert Haas writes: > On Tue, Jul 27, 2010 at 9:56 PM, Tom Lane wrote: >> Other than the fork() cost itself and whatever authentication activity >> there might be, practically all the startup cost of a new backend can be >> seen as cache-populating activities.  You'd have to redo all of that, >> *plus* pay the costs of getting rid of the previous cache entries. >> Maybe the latter costs less than a fork(), or maybe not.  fork() is >> pretty cheap on modern Unixen. > I agree that the gain is minimal of itself; after all, how often do > you need to switch databases, and what's the big deal if the > postmaster has to fork a new backend? Where I see it as a potentially > big win is when it comes to things like parallel query. I can't help > thinking that's going to be a lot less efficient if you're forever > forking new backends. Color me unconvinced. To do parallel queries with pre-existing worker processes, you'd need to hook up with a worker that was (at least) in your own database, and then somehow feed it the query plan that it needs to execute. I'm thinking fork() could easily be cheaper. But obviously this is all speculation (... and Windows is going to be a whole 'nother story in any case ...) regards, tom lane