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 1m8KqQ-000552-19 for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Jul 2021 11:01: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 1m8KqO-0001Lw-Sv for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Jul 2021 11:01:52 +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 1m8KqO-0001Lo-Jw for pgsql-bugs@lists.postgresql.org; Tue, 27 Jul 2021 11:01:52 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8KqJ-0002dT-Fm for pgsql-bugs@lists.postgresql.org; Tue, 27 Jul 2021 11:01:51 +0000 Received: from [192.168.129.197] (unknown [94.25.177.92]) (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 CEB3B21CA7E6 for ; Tue, 27 Jul 2021 14:01:44 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1627383705; bh=lv2CfBE6csC+5uTH7pVM7EyhMsgHpwMVtxLMju4MSkM=; h=Subject:To:References:From:Date:In-Reply-To; b=cCytyUmQpTlVKafvgqfQp5MbLBCwSDXJdYTdIRVFPNzgmWpioxkGwrJYjdfjfumny c2PFU+pK1zhM05kQU5F3LkcFvRGDixIZcviBtfIURChJmRCv2qWbmnIyv3XLTl5wT9 PlmkVAo8SOOqyk7yQ5vclh4EULhNRvpKPXn+PjtI= Subject: Re: The case when AsyncAppend exists also in the qual of Async ForeignScan To: pgsql-bugs@lists.postgresql.org References: <9df9ea6b-75cb-27bd-79c3-b9145f97e7b3@postgrespro.ru> From: "Andrey V. Lepikhov" Organization: Postgres Professional Message-ID: Date: Tue, 27 Jul 2021 16:00:39 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/27/21 3:50 PM, Etsuro Fujita wrote: > On Tue, Jul 27, 2021 at 3:22 PM Andrey V. Lepikhov > wrote: >> >> Maybe we can split async logic into: >> >> - receiving stage, when we only fetch and store tuples, >> >> - evaluating stage, when we form resulting tuple and return by a >> >> scan node. >> >> I will think about such solution more. > >> > One simple solution along this line I came up with, which is not the >> > rewrite, is to 1) split process_pending_request() into the two steps, >> > and 2) postpone the second step until we are called from >> > postgresForeignAsyncConfigureWait(), like the attached, which I think >> > would be much consistent with the existing logic. > >> Good idea. Are you planning to commit this patch? > > Cool! > > Here is an updated version of the patch, in which I added/tweaked > comments a bit further. I'm planning to push this version if there > are no objections from others. Thanks. In addition, I will use this patch in TPC-H benchmark tomorrow. > >> >> Also, may be you tell your opinion about an additional optimization >> >> of Async Append [1]? > >> > Is the optimization related to this issue? > >> This optimization tries to postpone choice of async subplans. It allows >> us to make a decision on async capable subplans after all plan >> flattening operations. > > Thanks for the explanation! My understanding is that the optimization > isn’t related to this issue. Right? Right -- regards, Andrey Lepikhov Postgres Professional