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 1m8GTp-0003jq-6F for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Jul 2021 06:22:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8GTo-0006Q4-5A for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Jul 2021 06:22:16 +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 1m8GTn-0006Pw-RG for pgsql-bugs@lists.postgresql.org; Tue, 27 Jul 2021 06:22:15 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8GTh-0000Te-2U for pgsql-bugs@lists.postgresql.org; Tue, 27 Jul 2021 06:22:14 +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 EB20921CB2A1; Tue, 27 Jul 2021 09:22:06 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1627366927; bh=Ju5ONiRruBqqPnJfn2E/pWsqBVd4heBp6FsktzhQ/ac=; h=Subject:To:Cc:References:Reply-To:From:Date:In-Reply-To; b=iSJT4p6YzSGz7Uzk9bH0dquTcfl1+oRehi5kobWHPZ93AI5eB9w2/fsuH7VWHMW0a 6Zemx99ppTOHxNItq9lCeZXiKixuMnpSY6GZjeC4b3bt8PipoW6twdFjadFrQ5WI7t aRIBheLh84zctK+PaeEDNKn3J2b+ZN/gP+2WAEk0= Subject: Re: The case when AsyncAppend exists also in the qual of Async ForeignScan To: Etsuro Fujita Cc: pgsql-bugs@lists.postgresql.org References: Reply-To: CAPmGK15eY_P5AEC6-HjZusx2euftT0KD94ywaeJ=f3NGTLJEFw@mail.gmail.com From: "Andrey V. Lepikhov" Organization: Postgres Professional Message-ID: <9df9ea6b-75cb-27bd-79c3-b9145f97e7b3@postgrespro.ru> Date: Tue, 27 Jul 2021 11:22:05 +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 >> I think it can be done, but only as a temporary solution. > My concern about that is that such an inconsistency would make the > code complicated, and thus make the maintenance hard. Agree, but your new patch is quite understandable. >> 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? >> Also, may be you tell your opinion about an additional optimization >> of Async Append [1]? > Is the optimization related to this issue? (Sorry, I didn’t have time > for reviewing the patch in [1] than expected. I plan to do so next > month.) 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. -- regards, Andrey Lepikhov Postgres Professional