Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nB0vB-000350-9u for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Jan 2022 20:54:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nB0vA-0002aO-77 for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Jan 2022 20:54:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nB0v9-0002XK-Tz for pgsql-hackers@lists.postgresql.org; Fri, 21 Jan 2022 20:54:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nB0v7-0003yt-Nz for pgsql-hackers@postgresql.org; Fri, 21 Jan 2022 20:54:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20LKs37k1279420; Fri, 21 Jan 2022 15:54:03 -0500 From: Tom Lane To: Robert Haas cc: James Coleman , pgsql-hackers , Amit Kapila Subject: Re: Parallelize correlated subqueries that execute within each worker In-reply-to: References: Comments: In-reply-to Robert Haas message dated "Fri, 21 Jan 2022 15:20:44 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1279418.1642798443.1@sss.pgh.pa.us> Date: Fri, 21 Jan 2022 15:54:03 -0500 Message-ID: <1279419.1642798443@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > I don't think there's an intrinsic problem with the idea of making a > tentative determination about parallel safety and then refining it > later, but I'm not sure why you think it would be a lot of work to > figure this out at the point where we generate gather paths. I think > it's just a matter of testing whether the set of parameters that the > path needs as input is the empty set. It may be that neither extParam > nor allParam are precisely that thing, but I think both are very > close, and it seems to me that there's no theoretical reason why we > can't know for every path the set of inputs that it requires "from the > outside." I'd be very happy if someone redesigned the extParam/allParam mechanism, or at least documented it better. It's confusing and I've never been able to escape the feeling that it's somewhat redundant. The real problem with it though is that we don't compute those values until much too late to be useful in path construction; see comments for SS_identify_outer_params. To be helpful to the planner, we'd have to rejigger things at least enough to calculate them earlier -- or maybe better, calculate what the planner wants earlier, and then transform to what the executor wants later. regards, tom lane