Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 530761337BD6 for ; Wed, 11 May 2011 08:07:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 44759-08 for ; Wed, 11 May 2011 11:06:58 +0000 (UTC) X-Greylist: delayed 17:04:10.333271 by SQLgrey-1.7.6 Received: from 26.mail-out.ovh.net (5.26.mail-out.ovh.net [46.105.57.162]) by mail.postgresql.org (Postfix) with SMTP id 9AD8C1337B96 for ; Wed, 11 May 2011 08:06:57 -0300 (ADT) Received: (qmail 9468 invoked by uid 503); 11 May 2011 10:33:25 -0000 Received: from b9.ovh.net (HELO mail620.ha.ovh.net) (213.186.33.59) by 26.mail-out.ovh.net with SMTP; 11 May 2011 10:33:25 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 11 May 2011 13:08:46 +0200 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13) (lists%peufeu.com@88.161.102.87) by ns0.ovh.net with SMTP; 11 May 2011 13:08:46 +0200 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "pgsql-performance@postgresql.org" Subject: Re: Postgres refusing to use >1 core References: <4DC81A3F020000250003D433@gw.wicourts.gov> <4DC81D56020000250003D438@gw.wicourts.gov> <4DC8B893.3060908@postnewspapers.com.au> <4DC9E733.8040809@postnewspapers.com.au> Date: Wed, 11 May 2011 13:06:53 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pierre C" Message-ID: In-Reply-To: <4DC9E733.8040809@postnewspapers.com.au> User-Agent: Opera Mail/11.10 (Linux) X-Ovh-Tracer-Id: 7943786793615558193 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.585 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SARE_MILLIONSOF=0.315 X-Spam-Level: X-Archive-Number: 201105/144 X-Sequence-Number: 43653 > I suspect your app is doing lots of tiny single-row queries instead of > efficiently batching things. It'll be wasting huge amounts of time > waiting for results. Even if every query is individually incredibly > fast, with the number of them you seem to be doing you'll lose a LOT of > time if you loop over lots of little SELECTs. Using unix sockets, you can expect about 10-20.000 queries/s on small simple selects per core, which is quite a feat. TCP adds overhead, so it's slower. Over a network, add ping time. In plpgsql code, you avoid roundtrips, data serializing, and context switches, it can be 2-4x faster. But a big SQL query can process millions of rows/s, it is much more efficient.