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 1jjHFh-0008S5-Qo for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2020 07:03:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jjHFf-0006km-FX for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2020 07:03:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjHFf-0006kf-5N for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2020 07:03:51 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jjHFc-0008KO-Qf for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2020 07:03:50 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 4ED7921C6D08; Thu, 11 Jun 2020 10:03:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.129.197] (unknown [94.25.177.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id D0B8E21C6D07; Thu, 11 Jun 2020 10:03:46 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1591859027; bh=piEaQ6n4EoQqiwd+C/9idB5ko1r9AYVs/AiaylEna3s=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=HqwamilBnHc18PQF6gx8d+ly4QpbWNgvSv4b2S1yMuhzYz3Pk7rsafqJpx5qLRrH3 HDsmaF0r4zyYn0jHbMLZKmwiiHZAANBhTpmdDqkTguOXObT8hycvV5RiT+XfgcMhgY eqp58OImHHJ5dzqyeYDyfyoSzrnR52XSBG9Byncg= Subject: Re: Asynchronous Append on postgres_fdw nodes. To: Kyotaro Horiguchi Cc: etsuro.fujita@gmail.com, movead.li@highgo.ca, pgsql-hackers@lists.postgresql.org References: <20200604.150015.2305436578805492574.horikyota.ntt@gmail.com> <90cced83-9061-0cac-0012-84e5faac8c78@postgrespro.ru> <20200610.120510.2075667454883130505.horikyota.ntt@gmail.com> From: "Andrey V. Lepikhov" Organization: Postgres Professional Message-ID: <91ccc069-1f87-233e-1680-94dac770abf2@postgrespro.ru> Date: Thu, 11 Jun 2020 12:03:45 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200610.120510.2075667454883130505.horikyota.ntt@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/10/20 8:05 AM, Kyotaro Horiguchi wrote: > Hello, Andrey. > > At Tue, 9 Jun 2020 14:20:42 +0500, Andrey Lepikhov wrote in >> On 6/4/20 11:00 AM, Kyotaro Horiguchi wrote: >> 2. Total cost of an Append node is a sum of the subplans. Maybe in the >> case of asynchronous append we need to use some reduce factor? > > Yes. For the reason mentioned above, foreign subpaths don't affect > the startup cost of Append as far as any sync subpaths exist. If no > sync subpaths exist, the Append's startup cost is the minimum startup > cost among the async subpaths. I mean that you can possibly change computation of total cost of the Async append node. It may affect the planner choice between ForeignScan (followed by the execution of the JOIN locally) and partitionwise join strategies. Have you also considered the possibility of dynamic choice between synchronous and async append (during optimization)? This may be useful for a query with the LIMIT clause. -- Andrey Lepikhov Postgres Professional