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 1kVbMz-0000bf-PO for pgsql-general@arkaria.postgresql.org; Thu, 22 Oct 2020 14:15: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 1kVbMy-0005EA-J2 for pgsql-general@arkaria.postgresql.org; Thu, 22 Oct 2020 14:15: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 1kVbMy-0005E3-BG for pgsql-general@lists.postgresql.org; Thu, 22 Oct 2020 14:15:08 +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 1kVbMw-0003S2-Cm for pgsql-general@postgresql.org; Thu, 22 Oct 2020 14:15:07 +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 09MEEYkG275743; Thu, 22 Oct 2020 10:14:34 -0400 From: Tom Lane To: "Hou, Zhijie" cc: "pgsql-general@postgresql.org" Subject: Re: Initplan placed at the righttree or the lefttree of joinnode In-reply-to: <133491a8ecc2456084e7050830d93202@G08CNEXMBPEKD05.g08.fujitsu.local> References: <133491a8ecc2456084e7050830d93202@G08CNEXMBPEKD05.g08.fujitsu.local> Comments: In-reply-to "Hou, Zhijie" message dated "Thu, 22 Oct 2020 09:43:27 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <275741.1603376074.1@sss.pgh.pa.us> Date: Thu, 22 Oct 2020 10:14:34 -0400 Message-ID: <275742.1603376074@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Hou, Zhijie" writes: > Can Initplan placed at the righttree or the lefttree of joinnode? Initplans generally get attached to the topmost node of a given (sub)query, cf create_plan(). You might be able to get what you want by having an unflattenable subquery as one input of a join. I do not think you're going to get any exciting results that way though ... as create_plan() notes, the exact spot where an initplan is attached to the tree isn't terribly relevant. regards, tom lane