Re: Add a greedy join search algorithm to handle large join problems

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Chengpeng Yan <chengpeng_yan(at)outlook(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add a greedy join search algorithm to handle large join problems
Date: 2025-12-11 17:07:54
Message-ID: 982de4a4-71b6-4d1d-afe2-35b1c5d43529@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/11/25 07:12, Pavel Stehule wrote:
>
>
> čt 11. 12. 2025 v 3:53 odesílatel John Naylor <johncnaylorls(at)gmail(dot)com
> <mailto:johncnaylorls(at)gmail(dot)com>> napsal:
>
> On Wed, Dec 10, 2025 at 5:20 PM Tomas Vondra <tomas(at)vondra(dot)me
> <mailto:tomas(at)vondra(dot)me>> 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2025-12-11 17:18:15 Re: [PATCH] Fix ARM64/MSVC atomic memory ordering issues on Win11 by adding explicit DMB ​barriers
Previous Message Álvaro Herrera 2025-12-11 16:56:13 Re: Fix and improve allocation formulas