Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fb3wM-00079F-Fo for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jul 2018 13:04:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fb3wK-0005QE-8s for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jul 2018 13:04:52 +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.89) (envelope-from ) id 1fb3wJ-0005Q7-QO for pgsql-hackers@lists.postgresql.org; Thu, 05 Jul 2018 13:04:52 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fb3wG-0004xr-Mu for pgsql-hackers@postgresql.org; Thu, 05 Jul 2018 13:04:50 +0000 Received: by mail-pf0-x244.google.com with SMTP id v9-v6so5384791pff.9 for ; Thu, 05 Jul 2018 06:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IJhEuUmM9O9HjvsYJcowTbzW7hx3t2fsRKBSKwiBLww=; b=mF6EDZMkxhbQT+Rr2JzShLDubTbMDQ+o5ag6PjrnRlRCurJeWh75WstRNvyNxVoPZn ezzpKbN0nR3wEC7iGBmDrSRGdi0E7Y/wNAwKvgqbPHnNSzSKa2gSwxxAVARlhH5ZkQ98 cE3B9RpsHbVMt5DygQSAyn/sJu5O2ndY44pd729Nf4mD+oYgjtKPaNa4fwm7tWca5gwx WpRHw0NQZt2D0MqE4deYuF8k/jJxhBMNofHxeozWobARbn9PZlUlzz2/LCRMEd8cZ4qP jGw2xnh+dgrY0yKXBiHqUkd/k2Eo7I7bSIOUEpMSePi1pyh7pMYeykcZhFt/5Qn7uVf3 DtXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IJhEuUmM9O9HjvsYJcowTbzW7hx3t2fsRKBSKwiBLww=; b=pzLexzEfsKURrR+Wu9W7FpWJbpbHJGKzPZZSvWje87s86xQzRpvrLTSAUUm634KUwu bVj/EE6ifZj7P0Zqt0qEq/V3Utm6JPzuzTfIIqxq5VGJgNLpNbUzvDn73s9+IZarkaXm Z+vekqgVUubsvfakJrdeiJFPxPaGOSJooygQ3mUPLSV8ERCbN1eO2GquauLUWlvUpSy4 awgO0eGPfdlsEmvo1/Ua42m6P042Lse28BvlJJ5Cma2uHO0rAYPSsKIMNuDhGDY8grL+ bIRAZaYjyx4xpN5pJytfAAFKP+cSi6clerfqRAc0nlHTI84aRyQGkxKfAlZyumlTUU/U JTUw== X-Gm-Message-State: APt69E1ZceAXfC0+CkLPyxWiH76trOyE13Nz5VvE1KjRw5uYyvWRfEtL 1T8/SpdHpLbjWXkN6CtvEl34JnZ5odwLHRv9s9Pvng== X-Google-Smtp-Source: AAOMgpdTwxSnNES/V/eB9IEKLI9djuHZV+wDE5k3IWZTL4pWMDfLAeYs/FxJFMM4yqR0MtpYKvNQbYtA9iZaZv7/lMc= X-Received: by 2002:a65:5641:: with SMTP id m1-v6mr5678809pgs.246.1530795887459; Thu, 05 Jul 2018 06:04:47 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:b43:0:0:0:0 with HTTP; Thu, 5 Jul 2018 06:04:46 -0700 (PDT) In-Reply-To: <5B3DFDDE.2020803@lab.ntt.co.jp> References: <5AF2E09F.9060208@lab.ntt.co.jp> <5AF440C2.3040805@lab.ntt.co.jp> <5AF59415.10309@lab.ntt.co.jp> <5AFC0865.8050802@lab.ntt.co.jp> <5AFD6580.5090308@lab.ntt.co.jp> <5AFE81CC.8000508@lab.ntt.co.jp> <5B17C5EC.1090602@lab.ntt.co.jp> <5B1E5071.1000704@lab.ntt.co.jp> <5B23A964.9020800@lab.ntt.co.jp> <5B28FB19.3090809@lab.ntt.co.jp> <5B39F47B.10707@lab.ntt.co.jp> <5B3C9C33.6030203@lab.ntt.co.jp> <5B3DFDDE.2020803@lab.ntt.co.jp> From: Ashutosh Bapat Date: Thu, 5 Jul 2018 18:34:46 +0530 Message-ID: Subject: Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled. To: Etsuro Fujita Cc: Robert Haas , Rajkumar Raghuwanshi , pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jul 5, 2018 at 4:45 PM, Etsuro Fujita wrote: > > > In the case where scanjoin_target_parallel_safe=false, we actually will > consider such parallel paths using the existing partial paths for the parent > appendrel in the code path shown in a previous email (note: we would already > have done generate_partitionwise_join_paths or set_append_rel_pathlist for > the parent appendrel in query_planner.) For such a parallel path, we might > need to do a projection in the Gather node for generating the SRF-free > scan/join target, but I think that would be still efficient. So, I'm not > sure that we really need to create child Gathers and generate an Append with > those Gathers, as you mentioned. I don't think it will be Append of Gathers, but Append where one of the subplans is Gather. I don't think that possibility is completely eliminated. > > Another thing I noticed is: actually, we don't produce an Append with child > Gathers in apply_scanjoin_target_to_paths, which I thought we would do that > in the case of scanjoin_target_parallel_safe=false, but I noticed I was > wrong. Sorry for that. The reason is because in that case, even if we > create new partial Append paths with child Gathers, we don't run > generate_gatehr_paths for the newly created partial paths at the end of that > function shown below, since the parent's consider_parallel flag is set to > false in that case: > > /* > * Consider generating Gather or Gather Merge paths. We must only do > this > * if the relation is parallel safe, and we don't do it for child rels > to > * avoid creating multiple Gather nodes within the same plan. We must do > * this after all paths have been generated and before set_cheapest, > since > * one of the generated paths may turn out to be the cheapest one. > */ > if (rel->consider_parallel && !IS_OTHER_REL(rel)) > generate_gather_paths(root, rel, false); Hmm. I don't think that's a great idea since such a plan might turn out cheaper esp. when there are very few children which could use parallel query and parallel append is possible at the top parent. But anyway, that's what it is today. But I think, we shouldn't write code assuming that an Append will never see a Gather below it. We might see some plans like that in future and need to change your code. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company