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 1lexpq-0003yp-FB for pgsql-hackers@arkaria.postgresql.org; Fri, 07 May 2021 10:35: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 1lexpp-0007Jg-DN for pgsql-hackers@arkaria.postgresql.org; Fri, 07 May 2021 10:35:53 +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 1lexpp-0007JY-5m for pgsql-hackers@lists.postgresql.org; Fri, 07 May 2021 10:35:53 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lexpn-0004QH-VP for pgsql-hackers@lists.postgresql.org; Fri, 07 May 2021 10:35:52 +0000 Received: from ip-192-168-0-192.is74.loc (pool-77-222-104-44.is74.ru [77.222.104.44]) (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 5119921C8193; Fri, 7 May 2021 13:35:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1620383751; bh=JLh7GestOMbhSQjyCuN8pYppSC1Klu26HHSUNoAl0b0=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=UmDB1K9QHRX1AXxGPIHh6t5xXx2ldTl0tFVa2HIHEL8KCy2gh3XDOM6h35WPIeLA3 0/nDleFDGN7DF7qAFcpYJUv6hjOA6zTLUBFz+Y1jNi0wQcXB7qMn585pYEw+bAZlbY Emv/ZiwaCHWON7972MjeRrL4q0MGkVjndmkzGo0w= Subject: Re: Asynchronous Append on postgres_fdw nodes. To: Etsuro Fujita Cc: Kyotaro Horiguchi , Justin Pryzby , PostgreSQL Hackers References: <20210331.101137.148208859959175708.horikyota.ntt@gmail.com> From: Andrey Lepikhov Organization: Postgres Professional Message-ID: <52d944ea-7d41-1d16-01b7-8d1edf5ea972@postgrespro.ru> Date: Fri, 7 May 2021 15:35:50 +0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/5/21 14:11, Etsuro Fujita wrote: > On Tue, Apr 27, 2021 at 3:57 PM Andrey V. Lepikhov > wrote: >> One more question. Append choose async plans at the stage of the Append >> plan creation. >> Later, the planner performs some optimizations, such as eliminating >> trivial Subquery nodes. So, AsyncAppend is impossible in some >> situations, for example: >> >> (SELECT * FROM f1 WHERE a < 10) >> UNION ALL >> (SELECT * FROM f2 WHERE a < 10); >> >> But works for the query: >> >> SELECT * >> FROM (SELECT * FROM f1 UNION ALL SELECT * FROM f2) AS q1 >> WHERE a < 10; >> >> As far as I understand, this is not a hard limit. > > I think so, but IMO I think this would be an improvement rather than a bug fix. > >> We can choose async >> subplans at the beginning of the execution stage. >> For a demo, I prepared the patch (see in attachment). >> It solves the problem and passes the regression tests. > > Thanks for the patch! IIUC, another approach to this would be the > patch you proposed before [1]. Right? Yes. I think, new solution will be better. -- regards, Andrey Lepikhov Postgres Professional