Re: Fix CPU cost of right-semi and right-anti hash joins

From: Haibo Yan <tristan(dot)yim(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix CPU cost of right-semi and right-anti hash joins
Date: 2026-08-24 16:41:20
Message-ID: CABXr29GkqUhpPuMiWCfKnWk_dMoGXNGyv_ehozONLp3ftd+5Nw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 24, 2026 at 1:35 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> On Sat, Aug 22, 2026 at 2:15 AM Haibo Yan <tristan(dot)yim(at)gmail(dot)com> wrote:
> > One small testing point: the new hj_small/hj_large cases have no non-hash
> > joinqual, so qp_qual_cost.per_tuple is zero and they don’t exercise the new
> > v4 branch.
>
> > Also the test comment saying cpu_tuple_cost and qp_qual_cost are both charged
> > on inner-side rows is no longer quite true for RIGHT_ANTI in v4.
>
> Right. Fixed.
>
> Attached is v5 of this patch. I plan to push it soon if there are no
> objections. It can result in plan changes, so I don't plan to
> back-patch it to stable branches. I once thought about pushing it to
> v19, but at this late phase of the v19 cycle I'm inclined not to.
> Maybe I would have done that if it were June.
>
> Any thoughts are welcome.
>
> - Richard

Thanks, v5 looks good to me. The RIGHT_ANTI qual-cost split now matches the
executor behavior I was seeing, and the added Join Filter test addresses my
previous testing concern.

I also agree with not back-patching this, and at this point in the cycle I’d
be inclined to leave v19 alone as well.

LGTM.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-08-24 16:58:47 Add a Nix flake
Previous Message Greg Burd 2026-08-24 16:25:48 Re: Add bms_offset_members() function for bitshifting Bitmapsets