Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0117B1337B54 for ; Mon, 7 Feb 2011 06:02:59 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 29238-03 for ; Mon, 7 Feb 2011 10:02:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com [209.85.161.46]) by mail.postgresql.org (Postfix) with ESMTP id 4CF211337B47 for ; Mon, 7 Feb 2011 06:02:51 -0400 (AST) Received: by fxm20 with SMTP id 20so4681414fxm.19 for ; Mon, 07 Feb 2011 02:02:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=RrQJ5xvS3tFh8ACCeIvnKiT1epgUrKmhe299gnjRsdo=; b=XmHvUe6m57OZs8jD+BhSX2kLBdz1hvzY7t+guKQZdMX+HqBMhigfRm5sWixziU4zdM 7FUzEcBFeG54sNTUNopfN3DQXIg03D3OBESHsQe7p1mPe9pVP3lfjluKOwxk+Y1X8wcz xVqJoTYmjFjH+VklbywGh8x6XPuXVTZqWJLRc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=lVng5yWFYJP8a3GeyIXh2pdquBHpZBHtEtJa/7VMx4RjdgveqCV5zFRC/EqEbhQxat JuIRcDHhTnYhg6PRNukyIdecG8f5FoHAbOQLlws2NpG5x16zxfBlZlubfULKrvWYFjNO bR6ALqBCluPUOmDZ7fbxGB+UuNF/S3pW1sEvM= Received: by 10.223.101.140 with SMTP id c12mr8641239fao.16.1297072970578; Mon, 07 Feb 2011 02:02:50 -0800 (PST) Received: from [10.1.1.57] (skuns.zoral.com.ua [91.193.166.194]) by mx.google.com with ESMTPS id l3sm727530fan.2.2011.02.07.02.02.48 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Feb 2011 02:02:49 -0800 (PST) Message-ID: <4D4FC351.4000105@gmail.com> Date: Mon, 07 Feb 2011 12:02:57 +0200 From: Vitalii Tymchyshyn User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Chris Browne CC: pgsql-performance@postgresql.org Subject: Re: getting the most of out multi-core systems for repeated complex SELECT statements References: <20110203105704.BAX82905@ms14.lnh.mail.rcn.net> <87lj1v1jep.fsf@cbbrowne.afilias-int.info> In-Reply-To: <87lj1v1jep.fsf@cbbrowne.afilias-int.info> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.046 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=1.553, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201102/283 X-Sequence-Number: 42421 Hi, all My small thoughts about parallelizing single query. AFAIK in the cases where it is needed, there is usually one single operation that takes a lot of CPU, e.g. hashing or sorting. And this are usually tasks that has well known algorithms to parallelize. The main problem, as for me, is thread safety. First of all, operations that are going to be parallelized, must be thread safe. Then functions and procedures they call must be thread safe too. So, a marker for a procedure must be introduced and all standard ones should be checked/fixed for parallel processing with marker set. Then, one should not forget optimizer checks for when to introduce parallelizing. How should it be accounted in the query plan? Should it influence optimizer decisions (should it count CPU or wall time when optimizing query plan)? Or can it simply be used by an operation when it can see it will benefit from it. Best regards, Vitalii Tymchyshyn