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 1wK8WD-000dnq-0k for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 05:40:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wK8WC-00AL2e-0n for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 05:40:28 +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 1wK8WB-00AL2W-2e for pgsql-hackers@lists.postgresql.org; Tue, 05 May 2026 05:40:27 +0000 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wK8W9-00000000GD4-2dxI for pgsql-hackers@lists.postgresql.org; Tue, 05 May 2026 05:40:26 +0000 Received: by mail-qv1-xf41.google.com with SMTP id 6a1803df08f44-8b9f2295a9dso11445506d6.3 for ; Mon, 04 May 2026 22:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1777959625; cv=none; d=google.com; s=arc-20240605; b=jzd3KNyORLJxCYO+76u2TsEfl9WCj+Y323jhzp5nKsXNRie9yGjSY6tfT/bcKsLQNL OYwe1ch4+2HDFJ/wEWpD10SJ4W8gAf03b8K6rs9vpeBQkUHup9iQSNI2ljjPyy3G8sgd 04JgE5M3J8O8YcBsJ3I4J9MCkeMRaV9JMmL/I0fffNO1/IYkxttGZ3sMdoJjgYwqn6LF WcXPwFEJZN60DK6j+s6xHPqkDphRW+MGbZdS7CSFyNn0RJodyyktQoy1ckYfy9ZjN6VW ljf/jzvhER0hzG71Mv0BiwNM+FIu0V3YRoyGuoX7apu2ZRA+pcNQxKxxXs2OZue/3S+s 0ucA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dW5J7B7NRNSlqw/dwSsODIqO2gEppvYerj2H7AWoLAk=; fh=B550wzTb3ZYhK199/uoZX8yfRUKutXeIqqaO+MRqRsY=; b=Ft3U8svfzbVxRAryLJXkdb90WRjFO0ZwAAdeLG7LEtyx5E6Du0wI2mmzDQ8iwHEoht 7krViIT1o+wpUAKUzZxDH+mZRLgW6gFPZgiy8yXNPvqX1+4jr7tyQmBJzio/5BnLOoha UA2FH2IPE0oBJBIpxn7p9RjC+QiTrCLaRZnVlwfvH5KX0TERz3BbybT998m5s94FFBZ2 avbTbeeHz0N9/pOwGH0A7elev3xJcy6W7hO/VYsrybSX+Ovrg94TgJEBNo4RjULceykx /rH3+itJ+QML5I/0iX5RN9OpAElFuQjh5UakmEy+bJHF4vDs35GU1QDaUcSsqhmARiCT TAjA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777959625; x=1778564425; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dW5J7B7NRNSlqw/dwSsODIqO2gEppvYerj2H7AWoLAk=; b=fNekgj4NJOPVAzKWldEevpLYmqdljdmKSJhDzW03WL2OuuJq3ItYaifhFAiZdeF/AW iRYUEy+86f0Aq2kS/MtV84f5YMZXdoYWMtKpWzULuisW9iIAcUg5yNcXr5BjQLcIXzzn c9obxrWzSwlJPkqcJL675OFc5mQWpiksTDNCz7nHlZvgs/TRz7qePxzr0XAKCuULiliN AW70+HBp5Ca5OvPC5vuyyIdMaRIwWTx04lJoDqS2/nrYhEBvvdgYa/LfrtCTdpCRv1F+ YhnwBZ4ViuALjZOJxq2gEKz55q66qaieFYBjj0+RLFUBVOx8+KFX9OwL+SJZ0sdR0kf3 EaGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777959625; x=1778564425; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dW5J7B7NRNSlqw/dwSsODIqO2gEppvYerj2H7AWoLAk=; b=hFeB/B4tgPTj7XGaQC2u3/iUBvQbWYLeXcg136Y6EtDMA0Jpv1+1IIQtOONNtVNpHh 6nJ+bvbEK63NKahYfc7njkFbCnpG9YveoCbRlj99OJ5Ix57JsmCgYbT6OJzj/xt/CN7L HfDwXPW1XvMxoxqXm8aZfZnyGR6cX7JB0/pWlsNsQl7QPcmG/zYKRZ/L4O72ayze1C7Z SHUKj200BtFcJpQ742B9+v/kCT6A37WYrCUzKI6TxbxdqoneI3KJyfKMVMMLRA95HxhO TysN9zfuC3E777pHfxOVF4dtFcr5Iph8lAdrvcaNzQjjzIc/x6Q47vkvRhugGigsv7Ow 4raQ== X-Forwarded-Encrypted: i=1; AFNElJ+qKer1zb/ZO2arGBiskjwY+iOxAkYPNEXvBUdPhTiDENxlEx0TAeMkpzgZ3gLEH2oyQAa0Lyw4x2l+I1XR@lists.postgresql.org X-Gm-Message-State: AOJu0YyuezWaKhmHNCROMaHHtPKYEQTlhtpNmUZuFzejZ4+OaXxEwRwk of+HyqdAQTM/J2cUkeRERb/X5FdlSEBZjTsArMchllLn7clZKkPJot0+AEKMNZ10virzHDXY2Qj YKQ1vNg6DI8SNLBdjUN1sf1HkKzylV2I= X-Gm-Gg: AeBDieuC9APp5PPVv9svECcuLvEJeV4jznRFKpRI2SdhT9T8fyk1Ak5ZRz6hY7VwrJc E2rWQYDpVIi5Ts6RfEt43X70tvSTeVeXFDsDug/BD4VgLI+V4Z02Gir9FSlzP+BjBqlQdxxTZ7R ztnShtx+quOGiVC+bTd09eoeYz2SFJDF3dshunGlJHs5uO57XMBthgep7THHvHz9HJfQjSIYJS2 U20sqM2m7lcvEelbSVs6OScp+/+9HA72KQ1km9gtaShhxJAym78Q7fW6qsWRZf50d1cjOe/kipI 8WZ4eu+QUEpzKS+hrKqIVvKPfZTHEu9c4zY5CdhYoO4LuSSukoB4hCt7sD8hULk/PNlgW3E7KXC 7Rnn4LzkCYs16VPGaDAooWzp8iu2VidWcIOxcYQ== X-Received: by 2002:a05:6214:1250:b0:89c:cc08:c3e with SMTP id 6a1803df08f44-8b6666e9a4emr198208586d6.15.1777959625143; Mon, 04 May 2026 22:40:25 -0700 (PDT) MIME-Version: 1.0 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> <982de4a4-71b6-4d1d-afe2-35b1c5d43529@vondra.me> <8927A117-A7EA-41E8-94B3-0B4F7767DA8B@outlook.com> In-Reply-To: From: John Naylor Date: Tue, 5 May 2026 12:40:13 +0700 X-Gm-Features: AVHnY4Krz0aoPVHa5uZr5wC_W2dxxkqxKMBwbb8IpEEAXiMRVOSgLV1090fmoa0 Message-ID: Subject: Re: Add a greedy join search algorithm to handle large join problems To: Chengpeng Yan Cc: Tomas Vondra , lakshmi , Pavel Stehule , "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, May 3, 2026 at 7:46=E2=80=AFPM Chengpeng Yan wrote: > > On Feb 14, 2026, at 13:39, Chengpeng Yan wr= ote: > > 1. Continue evaluating plan quality on more datasets/workloads. I=E2=80= =99ve > > already collected several candidate tests: some are JOB-based > > variants, and others are synthetic workloads. Next, I plan to > > consolidate these into a unified test set (with reproducible > > setup/details), publish it, and run broader comparative evaluation. > I ran the current pure-GOO variants on JOB and JOB-Complex [1], 143 > queries in total. JOB-Complex uses the same IMDB/JOB setting, but adds > harder predicates and more challenging join patterns. The tested Thanks for those results. As Tomas mentioned above, evaluation should focus on cases where DP won't be used. Joins with a small number of relations aren't going to tell us anything, especially since (I think) GEGO will at times accidentally cover the entire seach space. Indeed, there are quite a few queries where GOO is worse than GEQO by around 2-3x, but also small enough to be handled by DP anyway, so reporting them is a distraction. Less than half of the JOB-Complex queries have at least 12 "joins" (BTW, is that number in the pdf actual joins or is it base relations?), but the results (and summary results) include small joins as well. Looking at the queries where one of GOO/GEQO is much better than the other do seem to happen with large join problems. > GOO(combined) with cost and result_size may already be a useful baseline > or candidate generator, but the regressions above do not support making > it the default GEQO replacement. One possible advantage over GEQO is > that GOO may work better with pg_plan_advice, but I need to understand > the details better before making a stronger claim. Given that all heuristic join enumeration methods can produce spectacularly bad plans, the ability to influence the plan is more crucial with large join problems with small ones. Features should be orthogonal in general, and in this case, integrating well with plan advice seems like a strong deciding factor. -- John Naylor Amazon Web Services