Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXy6O-00AXvL-10 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2025 08:50:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vXy6N-000pNu-0d for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2025 08:50:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXy6M-000pNl-2L for pgsql-hackers@lists.postgresql.org; Tue, 23 Dec 2025 08:50:43 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXy6L-002Her-0E for pgsql-hackers@postgresql.org; Tue, 23 Dec 2025 08:50:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1766479839; bh=XP+O9Sb+6RXrh8hW23VbQCqcMuD7iSYlg5SV6RrnlOE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:From; b=KRkU8dCEuQKpol8dLm8j8oxxWjru1ml0qV1txcJmdSdaWWZiv7jpveY5qO4c9/uVF 50cLCl7T9XSVccJsr+nW+HHn6ANwyGmzGrC9gMDmI8VVTi19jq9dgS5kfe66LtipUz ouVjLCsFStil+vDDy9bm1P314yXMTyVI6YGqkIV/bj1bPibosxp6XeLHRJLDl3T8h2 fYwXrCSNFN1c9kDqpIvF8Yfz+Lhpge8iav0ZyLjXwokWSa7mpIGe8xC/gmAXowOces JwohSjgjf15RNPhRhC8nMtd8b074arBN5xWwCV01evfP5Ui3e9J6jd0TKUAFcEGgvm mkUQX+QEs/7ag== Received: from mail.postgrespro.ru (webmail-slave-mstn.l.postgrespro.ru [192.168.2.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.pyhalov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 9CF4F6012A; Tue, 23 Dec 2025 11:50:39 +0300 (MSK) MIME-Version: 1.0 Date: Tue, 23 Dec 2025 11:50:39 +0300 From: Alexander Pyhalov To: Matheus Alcantara Cc: Alena Rybakina , Pgsql Hackers Subject: Re: Asynchronous MergeAppend In-Reply-To: References: <59be194c5a409fb9fc9f2031581b8a44@postgrespro.ru> <764dd8b8-6374-4f5a-aac7-d8e3f6ebe5fd@postgrespro.ru> <159b591411bb2c81332018927acbd509@postgrespro.ru> <2fb1d9923b6995492e7b163e6cb95402@postgrespro.ru> Message-ID: X-Sender: a.pyhalov@postgrespro.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/12/23 07:19:00 #28056131 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Matheus Alcantara писал(а) 2025-12-19 16:45: > On Thu Dec 18, 2025 at 6:56 AM -03, Alexander Pyhalov wrote: >>> + noccurred = WaitEventSetWait(node->ms_eventset, -1 /* no timeout */ >>> , >>> occurred_event, >>> + nevents, WAIT_EVENT_APPEND_READY); >>> >>> Should we use the same WAIT_EVENT_APPEND_READY or create a new wait >>> event for merge append? >> >> I'm not sure that new wait event is needed - for observability I think >> it's not critical >> to distinguish Append and MergeAppend when they waited for foreign >> scans. But also it's perhaps >> doesn't do any harm to record specific wait event. >> > Ok, I think that we can keep this way for now and let's see if a new > wait event is really needed. > >>> I've created Appender and AppenderState types that are used by >>> Append/MergeAppend and AppendState/MergeAppendState respectively (I >>> should have think in a better name for these base type, ideas are >>> welcome). The execAppend.c was created to have the functions that can >>> be >>> reused by Append and MergeAppend execution. I've tried to remove >>> duplicated code blocks that was almost the same and that didn't >>> require >>> much refactoring. >> >> Overall I like new Appender node. Splitting code in this way really >> helps to avoid code duplication. >> However, some similar code is still needed, because logic of getting >> new >> tuples is different. >> Hi. I've looked through updated patch. Tested it (also with our fdw). Overall looks good. In execAppend.c there's still reference to as_valid_subplans. Also we could perhaps use palloc0_array() in some more places, for example, for for state->asyncrequests and state->asyncresults. -- Best regards, Alexander Pyhalov, Postgres Professional