Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYakQ-00040m-9p for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2018 16:58:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYakP-0002EB-FN for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2018 16:58:05 +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 1eYakP-0002E1-8i for pgsql-hackers@lists.postgresql.org; Mon, 08 Jan 2018 16:58:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eYakM-00016t-Bq for pgsql-hackers@postgresql.org; Mon, 08 Jan 2018 16:58:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w08Gvwih004161; Mon, 8 Jan 2018 11:57:58 -0500 From: Tom Lane To: Robert Haas cc: Jim Finnerty , "pgsql-hackers@postgresql.org" Subject: Re: Parallel append plan instability/randomness In-reply-to: References: <7752.1515284083@sss.pgh.pa.us> <7400.1515390981@sss.pgh.pa.us> <1515428895102-0.post@n3.nabble.com> <2171.1515429722@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 08 Jan 2018 11:48:59 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4159.1515430678.1@sss.pgh.pa.us> Date: Mon, 08 Jan 2018 11:57:58 -0500 Message-ID: <4160.1515430678@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Mon, Jan 8, 2018 at 11:42 AM, Tom Lane wrote: >> More generally, I wonder if >> it wouldn't be better to implement this behavior at runtime rather >> than plan time. > Ignoring some details around partial vs. non-partial plans, that's > pretty much what we ARE doing, but to make it efficient, we sort the > paths at plan time so that those choices are easy to make at runtime. > If we didn't do that, we could have every worker sort the paths at > execution time instead, or have the first process to arrive perform > the sort and store the results in shared memory while everyone else > waits, but that seems to be more complicated and less efficient, so I > don't understand why you're proposing it. The main bit of info we'd have at runtime that we lack at plan time is certainty about the number of available workers. Maybe that doesn't really add anything useful to the order in which subplans would be doled out; not sure. regards, tom lane