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 1vQltr-00HXD3-17 for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 12:24:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQltp-00DBOL-2H for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 12:24:02 +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 1vQltp-00DBOD-1O for pgsql-hackers@lists.postgresql.org; Wed, 03 Dec 2025 12:24:01 +0000 Received: from lahtoruutu.iki.fi ([185.185.170.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQltn-002upG-32 for pgsql-hackers@lists.postgresql.org; Wed, 03 Dec 2025 12:24:01 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4dLxdP6MNmz49Q2Z; Wed, 03 Dec 2025 14:23:53 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1764764634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qzXWFX3huXYH3b3c2Ub8qqn1F2DTxlFVnjpJJMe5IBY=; b=hRnJfwKOjgIR/xEfAYTVhCSq+SL87ji7Im/FEhJZ7/P7Y2r7oDJznHoAD/tvtaGMazdYfC 3bcrGSEvF3ZoKlsLg2l05L78KXZV7v6Sct/Hw0dlUk+yMz5JjkriTbsEWoeU0E3OxM1+gi 97Q4YGfRXSRGIeOx18aNeTSKJfRXgxErZ95jQ4KGngicJhqHEZZ0+XsrHLryIZBVrvag0H Zd92Xw/xA+XOoe15SiwG0rtAVtoWi0uVwiULaZnuM0/AmNSnh5Lvb62PlUz8qB4VGMD7EJ 0IJoya8lq9eF/vi2K2dn6lvw84rZu9jEIVozerdSGTH/1VHkk/5dM5/mM8HEXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1764764634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qzXWFX3huXYH3b3c2Ub8qqn1F2DTxlFVnjpJJMe5IBY=; b=NO3bqWCpfO326z/D+31HZv3UFKYexDdE7jpvtUAHsPr/xr9QlvHKJSX9GaRMFoalETLh5b BXPugiyy+fr5KcKXIlD2DChcDcMZSzq0NraXtvndaz/wRlw84hVRp06VR9UQnBgTT94YPM jteBviiRIjjjFF7g9GGOpiz1kHrBpCa2iKWH3yJ96Z6d7PN/14jOgsOjAPYOtYDB9hLHgK ADlqXw/6hDQaG5DOGm1LwltYnX8tcjKDYfzutwur4XvRpmi4p/cvJXqfaR8p2CxpPq0XDd EPuRBzW40VN+bXE7YUzEACuIQuiHLHoc7+3OI/8NJZzpyUmdaiCrAh84ucXGRQ== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1764764634; b=ckzyxKoavkRD28rMXQfuWmHtF/6adNQPpKlFmTwv2vQ9sYacwqyuP7E95CwRXrjWoYHQ5n ySxK1Sx9wMIn5T+TiYx+i01RawJgl08FjYypfyb74RE30WErGHyBUZs9dSqu3AbFoP6wxW PyFQ8W+OjeDZhckacmj8Ecwzf4VFGr7RUlHiHtxyBQ0AvbPkWnwCDaOGQkibOCwFxWTDdf ueN9cTzSXDa55Acpy78Z63EQl/TJiLEnKK/iFkHFeQb08mG+ZijTCoCrbV/+Npk+kMVDOn ozontshRWpaRbm4fxuTwYh25hoYZUz+PIhffAYn9eMakjh83dfP/WeoBaTJoRg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: <28f47336-84e2-445e-8216-d1ce7d3ddc3e@iki.fi> Date: Wed, 3 Dec 2025 14:23:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Support loser tree for k-way merge To: cca5507 , pgsql-hackers References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 03/12/2025 13:48, cca5507 wrote: > With the WIP patch(v1-0001), I got a 3% ~ 13%(different work_mem) speed up in the following test case: Nice speedup! > 1) Now I add a GUC 'enable_loser_tree' to control the use of loser tree, maybe we should > decide whether to use the 'loser tree' based on the value of 'k', the complexity of tuple > comparators or just always use the 'loser tree'? What is the worst case scenario for the loser tree, where the heap is faster? How big is the difference? - Heikki