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 1wCaO4-0028IS-1d for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Apr 2026 09:48:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wCaO2-00BB0E-2Q for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Apr 2026 09:48:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wCaO2-00BB05-12 for pgsql-hackers@lists.postgresql.org; Tue, 14 Apr 2026 09:48:51 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wCaNz-00000000x1b-47fI for pgsql-hackers@postgresql.org; Tue, 14 Apr 2026 09:48:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1776160125; bh=Ex3H09KMTx285ZCu9Pbk7WUo6HTdl5j+LLZS7gRSEc4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:From; b=ki2vDxfz6HR5kbncxWHk/spFKXa4CDLDGb4Dia+pHTe9AozrPI1zxWMkAU+Uzw6Yy 6u3SUiaeuKDlKvBXdDpfOsSoEEBcjSGp5CQiT2bDsW6eoAcgfzS1E96tujwxoHEYVm FioUnREkE4q5FAs5TDl/5nV5y3RuCQWA6zMIQO0cLcJCFEkrTDEjJD7dunHXUk7h2K 7LkrDN193rzxi0b0mzgNnWDtk7wYm8NCVqRzCHyPxdkOoLvSYv7slx3aW572hJPp8R KjK7dwTJ04ILSEJ0vrv+4JGJ8No8cPbV9PSxBSWh4owdpu95LIuTnotIkO4F4AkJWI GO3XJs0tLihtQ== Received: from mail.l.postgrespro.ru (webmail-master-mstn.l.postgrespro.ru [192.168.2.26]) (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 4279D5FF4F; Tue, 14 Apr 2026 12:48:45 +0300 (MSK) MIME-Version: 1.0 Date: Tue, 14 Apr 2026 12:48:45 +0300 From: Alexander Pyhalov To: Alexander Korotkov Cc: Matheus Alcantara , Pgsql Hackers Subject: Re: Asynchronous MergeAppend In-Reply-To: <10c97af0ce34ebdb81708b1c49ed6038@postgrespro.ru> References: <59be194c5a409fb9fc9f2031581b8a44@postgrespro.ru> <2fb1d9923b6995492e7b163e6cb95402@postgrespro.ru> <782a968c8e01ec6db3b2da2120adf73b@postgrespro.ru> <554a73f7ffea8b22b3f81a4804b5fc34@postgrespro.ru> <42a9a941-e768-4fd8-8067-12958c5a1d70@gmail.com> <10c97af0ce34ebdb81708b1c49ed6038@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, bases: 2026/04/14 09:20:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 3.0.0.9059, bases: 2026/04/14 08:44:00 #28397241 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 Alexander Pyhalov писал(а) 2026-04-13 18:09: > Hi. > > Looked at it. Overall I agree that when we wait for data from one slot > after node initialization, we can't get data from other slots - they > are already either exhausted, or have already received data which is > not needed for now. So it seems that async machinery on later stages is > useless. > > Was a bit surprised that asyncresults field is not used in async merge > append anymore, as we save result directly in ms_slots. However, as we > do it only on initial stage, this seems to be OK. > > classify_matching_subplans() comment still refers to ms_valid_subplans. > > Will look at it once again tomorrow. Haven't found anything suspicious (besides redundant empty line after enable_async_merge_append GUC description in src/backend/utils/misc/guc_parameters.dat). Tested it and was a bit surprised that new async Merge Append version (without async machinery after nodeMergeAppend initialization) was about 5% faster than the old one with concurrent queries (-j 16) and 10-15% faster with single-thread load (when there was a lot of CPU capacity) in my tests (test was basically the same as in [1]). So, async machinery after Merge Append node is initialized was not only useless, but even harmful. Test results: patch version | concurrency | async_capable off | async_capable on old | -c 1 -j 1 | 880 tps | 1428 tps (+62%) old | -c 16 -j 16 | 5190 tps | 4933 tps (-5%) new | -c 1 -j 1 | 888 tps | 1582 tps (+78%) new | -c 16 -j 16 | 5020 tps | 5256 tps (+4%) 1. https://www.postgresql.org/message-id/159b591411bb2c81332018927acbd509%40postgrespro.ru -- Best regards, Alexander Pyhalov, Postgres Professional