Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYbtM-0007ui-AZ for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2018 18:11:24 +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 1eYbtL-0005sa-LI for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2018 18:11:23 +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_2) (envelope-from ) id 1eYbtL-0005sP-Bj for pgsql-hackers@lists.postgresql.org; Mon, 08 Jan 2018 18:11:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eYbtI-0006GH-Nv for pgsql-hackers@postgresql.org; Mon, 08 Jan 2018 18:11:22 +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 w08IBFtP007734; Mon, 8 Jan 2018 13:11:15 -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> <4160.1515430678@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 08 Jan 2018 12:45:42 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7732.1515435075.1@sss.pgh.pa.us> Date: Mon, 08 Jan 2018 13:11:15 -0500 Message-ID: <7733.1515435075@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > [ example where current parallel-append dispatch algorithm loses ] I should clarify my thinking a bit more: I was imagining that we might switch to a system where, as each worker comes free, it makes a dynamic choice of which subplan to take next. That means that not only do we have more knowledge of the number of available workers than the planner did, but we also have hard knowledge of which subplans actually finished first. So even (or especially?) granted that the cost estimates are imperfect, that might provide a leg up in choosing how to schedule the remaining tasks. I haven't thought about it hard enough to have a clear idea of how that might win. But for sure I don't think we should dismiss out of hand the idea that it could be better than choosing a fixed dispatch order at plan time. Anyway, I'm merely suggesting that as an approach worth investigating in future research; I doubt anyone is going to produce an implementation right away. So we still want to figure out exactly what happened on silverfish and how we can nail down that expected plan shape. (Or, perhaps, decide that we don't need to see that plan in the output?) regards, tom lane