Re: should we have a fast-path planning for OLTP starjoins?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: James Hunter <james(dot)hunter(dot)pg(at)gmail(dot)com>, Richard Guo <guofenglinux(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: should we have a fast-path planning for OLTP starjoins?
Date: 2025-11-08 20:36:37
Message-ID: 1504867.1762634197@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[ Don't have time to read the v4 patch right now, but a couple
of quick responses: ]

Tomas Vondra <tomas(at)vondra(dot)me> writes:
> On 9/23/25 21:46, Tom Lane wrote:
>> I'd be slightly inclined to put the GUC test there, too:
>>
>> + if (enable_starjoin_join_search)
>> + joinlist = starjoin_adjust_joins(root, joinlist);

> I'm not sure I like this very mcuh. No other call in query_planner()
> does it like that. Most don't have such GUC, but at least
> remove_useless_self_joins does, and it still doesn't check it here.

Fair enough, it was just a suggestion.

> When thinking about this, I realized the has_join_restriction() is only
> ever used in join_search_one_level(), i.e. when dealing with each small
> join order problem. Doesn't this mean the deconstructed jointree must
> already consider the restrictions in some way? I don't see any explicit
> mentions of such join order restrictions in deconstruct_recurse. It must
> not violate any ordering restrictions by splitting the joins in a
> "wrong" way, right? If I set join_collapse_limit=1 it still needs to
> satisfy all the rules.

Performing outer joins in syntactic order is always OK by definition,
and setting join_collapse_limit to 1 just forces that to happen.
So I guess you could say that the original jointree "considers the
restrictions", and it's only after we flatten an outer join's two
sides into a joinlist (along with other rels) that we have to worry.
Or is that not what you meant?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2025-11-08 21:40:26 Re: MSVC: Improve warning options set
Previous Message Joshua Shanks 2025-11-08 20:21:24 [PATCH] libpq: Wrap out-of-memory error messages with libpq_gettext()