Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCtYQ-0007Zw-Sy for pgsql-performance@arkaria.postgresql.org; Wed, 08 Jul 2015 17:54:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZCtYQ-0000E8-DF for pgsql-performance@arkaria.postgresql.org; Wed, 08 Jul 2015 17:54:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZCtW1-0006V7-Uk for pgsql-performance@postgresql.org; Wed, 08 Jul 2015 17:52:14 +0000 Received: from lists.commandprompt.com ([69.168.55.30]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZCtVz-0002sq-2g for pgsql-performance@postgresql.org; Wed, 08 Jul 2015 17:52:12 +0000 Received: from [192.168.1.3] (spinlock.commandprompt.com [69.168.55.30]) by lists.commandprompt.com (Postfix) with ESMTPA id 7191D254; Wed, 8 Jul 2015 10:52:09 -0700 (PDT) Received: from [192.168.1.3] ([67.168.169.165] helo=[192.168.1.3]) by assp.commandprompt.com with ESMTPS(AES128-SHA) (2.1.1); 8 Jul 2015 10:52:09 -0700 Message-ID: <559D6348.6000508@commandprompt.com> Date: Wed, 08 Jul 2015 10:52:08 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Craig James CC: "Graeme B. Bell" , postgres performance list Subject: Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this? References: <6E55113B-FA05-433C-9B21-623F798EE935@skogoglandskap.no> <559CB5BF.2080509@commandprompt.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Assp-Version: 2.1.1(11364) on assp.commandprompt.com X-Assp-Client-SSL: yes X-Assp-ID: assp.commandprompt.com m1-77929-09659 X-Assp-Envelope-From: jd@commandprompt.com X-Assp-Intended-For: pgsql-performance@postgresql.org X-Assp-Original-Subject: Re: [PERFORM] Hmmm... why does CPU-intensive pl/pgsql code paralleliseso badly when queries parallelise fine? Anyone else seen this? X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 07/08/2015 10:48 AM, Craig James wrote: > I admit that I haven't read this whole thread but: > > Using Apache Fast-CGI, you are going to fork a process for each > instance of the function being executed and that in turn will use > all CPUs up to the max available resource. > > With PostgreSQL, that isn't going to happen unless you are running > (at least) 8 functions across 8 connections. > > > Well, right, which is why I mentioned "even with dozens of clients." > Shouldn't that scale to at least all of the CPUs in use if the function > is CPU intensive (which it is)? In theory but that isn't PostgreSQL that does that, it will be the kernel scheduler. Although (and I am grasping at straws): I wonder if the execution is taking place outside of the backend proper or... are you using a pooler? JD > > Craig > > > > > JD > > -- > Command Prompt, Inc. - http://www.commandprompt.com/ 503-667-4564 > PostgreSQL Centered full stack support, consulting and development. > Announcing "I'm offended" is basically telling the world you can't > control your own emotions, so everyone else should do it for you. > > > > > -- > --------------------------------- > Craig A. James > Chief Technology Officer > eMolecules, Inc. > --------------------------------- -- Command Prompt, Inc. - http://www.commandprompt.com/ 503-667-4564 PostgreSQL Centered full stack support, consulting and development. Announcing "I'm offended" is basically telling the world you can't control your own emotions, so everyone else should do it for you. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance