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 1vTk95-009khP-2E for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Dec 2025 17:08:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vTk93-004XBp-2M for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Dec 2025 17:08: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 1vTk93-004XBg-0w for pgsql-hackers@lists.postgresql.org; Thu, 11 Dec 2025 17:08:02 +0000 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vTk90-000CPg-2f for pgsql-hackers@lists.postgresql.org; Thu, 11 Dec 2025 17:08:01 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id D4CFF443C1; Thu, 11 Dec 2025 17:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1765472876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f1Dix3YGSNTJJz/1B98XcfmV4hBZtNrA8YPM2Wh2uts=; b=COrNp/XAcfc6y45Ndsf7WOWbTxxqrvL+/Eo0On3lBPdOjnfBp03ggNriHXUBaYzQmQoC1e UaAZXnBUbYgBVGmfyAUbWXU/ENDMFD8wBhDRNtlD74x2xyL+ELKf5WsLsk7a7JntzwcEK6 M1/bngV8/HbkPzkgT20mqo8BynmqWoyZ5C1r9xf2Us0DxybGyqVhkIfBs15wb5CbGuhkXz 6yYN1JlIivjppg2cMP827MDdIWUDzYaB+hHl5daOy6agkqiC/YKOCtB1oZVUw26aetr2xi 72O36TkSZTK7uK8PVgijhb8ossYApzzxZ2bHuPVk+nG7yRTs1jOFRe+BWJGWfQ== Message-ID: <982de4a4-71b6-4d1d-afe2-35b1c5d43529@vondra.me> Date: Thu, 11 Dec 2025 18:07:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add a greedy join search algorithm to handle large join problems To: Pavel Stehule , John Naylor Cc: Chengpeng Yan , "pgsql-hackers@lists.postgresql.org" References: <3FF63E99-AB4F-41A9-BC78-AAB28823FBD0@Outlook.com> <6db6d2ec-7529-4add-9a95-178fc318311d@vondra.me> <313ACE5A-CBF1-43B3-9181-10D3E8ADF424@Outlook.com> <5abd6054-413c-4f48-9172-d8b31062b266@vondra.me> <938E2286-9B0D-4F8D-A916-8E0E35D55034@Outlook.com> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: tomas@vondra.me X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvheekiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpefvohhmrghsucggohhnughrrgcuoehtohhmrghssehvohhnughrrgdrmhgvqeenucggtffrrghtthgvrhhnpeeuvddvieefffefkedugefgtdeigeelgfegudehffevieehgffghefgvdduteffveenucfkphepkeeirdegledrvdeftddrvddtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekiedrgeelrddvfedtrddvtdeipdhhvghloheplgdutddrudefjedrtddrvdgnpdhmrghilhhfrhhomhepthhomhgrshesvhhonhgurhgrrdhmvgdpqhhiugepffegvefhhfeggeefvedupdhmohguvgepshhmthhpohhuthdpnhgspghrtghpthhtohepgedprhgtphhtthhopehprghvvghlshhtvghhuhhlvgesghhmrghilhdrtghomhdprhgtphhtthhopehjohhhnhgtnhgrhihlohhrlhhssehgmhgrihhlrdgtohhmpdhrtghpthhtoheptghhvghnghhpvghnghgphigrnhesohhuthhlohhokhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-GND-State: clean X-GND-Score: -100 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/11/25 07:12, Pavel Stehule wrote: > > > čt 11. 12. 2025 v 3:53 odesílatel John Naylor > napsal: > > On Wed, Dec 10, 2025 at 5:20 PM Tomas Vondra > wrote: > > I did however notice an interesting thing - running EXPLAIN on the 99 > > queries (for 3 scales and 0/4 workers, so 6x 99) took this much time: > > > > master:       8s > > master/geqo: 20s > > master/goo:   5s > > > It's nice that "goo" seems to be faster than "geqo" - assuming the > plans > > are comparable or better. But it surprised me switching to geqo > makes it > > slower than master. That goes against my intuition that geqo is > meant to > > be cheaper/faster join order planning. But maybe I'm missing > something. > > Yeah, that was surprising. It seems that geqo has a large overhead, so > it takes a larger join problem for the asymptotic behavior to win over > exhaustive search. > > > If I understand correctly to design - geqo should be slower for any > queries with smaller complexity. The question is how many queries in the > tested model are really complex. > Depends on what you mean by "really complex". TPC-DS queries are not trivial, but the complexity may not be in the number of joins. Of course, setting geqo_threshold to 2 may be too aggressive. Not sure. regards -- Tomas Vondra