Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avSvY-0003JG-G6 for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Apr 2016 17:07:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1avSvY-0005kZ-1R for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Apr 2016 17:07:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1avSuC-00040J-I3 for pgsql-hackers@postgresql.org; Wed, 27 Apr 2016 17:05:40 +0000 Received: from ks311736.kimsufi.com ([188.165.209.130]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avSu8-0000ar-J7 for pgsql-hackers@postgresql.org; Wed, 27 Apr 2016 17:05:40 +0000 Received: from genius-map.net (verite.pro [195.154.189.246]) by ks311736.kimsufi.com (Postfix) with ESMTP id 57D7EC0617; Wed, 27 Apr 2016 19:25:59 +0200 (CEST) Received: by genius-map.net (Postfix, from userid 1001) id 6DFC238A2805; Wed, 27 Apr 2016 19:05:34 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Rename max_parallel_degree? From: "Daniel Verite" To: "Robert Haas" Cc: "Tom Lane" ,"Magnus Hagander" ,"Bruce Momjian" ,"PostgreSQL-development" In-Reply-To: Date: Wed, 27 Apr 2016 19:05:32 +0200 Message-Id: <96e8e19e-c6fc-4800-af98-8a9799688dd3@mm> X-Mailer: Manitou v1.5.0 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas wrote: > Of course, we could make this value 1-based rather than 0-based, as > Peter Geoghegan suggested a while back. But as I think I said at the > time, I think that's more misleading than helpful. The leader > participates in the parallel plan, but typically does far less of the > work beneath the Gather node than the other nodes involved in the > query, often almost none. In short, the leader is special. > Pretending that it's just another process involved in the parallel > group isn't doing anyone a favor. FWIW, that's not how it looks from the outside (top or vmstat). I'm ignorant about how parallel tasks are assigned in the planner, but when trying various values for max_parallel_degree and running simple aggregates on large tables on a single 4 core CPU doing nothing else, I'm only ever seeing max_parallel_degree+1 processes indiscriminately at work, often in the same state (R running or D waiting for disk). Also when looking at exec times, for a CPU-bound sample query, I get for instance the results below, when increasing parallelism one step at a time, on a 4-core CPU. I've checked with EXPLAIN that the planner allocates each time a number of workers that's exactly equal to max_parallel_degree. ("Workers Planned" under the Gather node). mp_degree | exec_time | speedup (against degree=3D0) -----------+-----------+--------- 0 | 10850.835 | 1.00 1 | 5833.208 | 1.86 2 | 3990.144 | 2.72 3 | 3165.606 | 3.43 4 | 3315.153 | 3.27 5 | 3333.931 | 3.25 6 | 3354.995 | 3.23 If the leader didn't do much work here, how would degree=3D1 produce such a speedup (1.86) ? There's also the fact that allowing 4 workers does not help compared to 3, even though there are 4 cores here. Again, doesn't it make sense only if the leader is as important as the workers in terms of CPU usage?=20 Best regards, --=20 Daniel V=E9rit=E9 PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers