Re: Fix rescan costing of single-batch hash joins

From: Nazneen Jafri <jafrinazneen(at)gmail(dot)com>
To: Baji Shaik <baji(dot)pgdev(at)gmail(dot)com>
Cc: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Fix rescan costing of single-batch hash joins
Date: 2026-10-22 15:02:02
Message-ID: CA+m5N8v3zZAs5WXwbN3m+xKJzqWbKN3qry3R6rYzfSOMPsu2Fg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Baji, Etsuro,

Reproduced both repro scripts on two PG18.4 builds (same REL_18_4 tag, one
unpatched, one with just the costsize.c hunk). Output attached.

repro_plain.sql: plan shapes match your report exactly (Hash Join -> Nested
Loop+Memoize).

repro_e2e.sql: plan_cache_mode=auto, no config changes --
unpatched: generic_plans=0, custom_plans=10, ~65 ms/call
patched: generic_plans=5, custom_plans=5, ~1.8 ms/call

Confirms the undercosted custom plan was defeating the plan cache's own
generic-vs-custom check.

Thanks,
Nazneen

On Thu, Oct 22, 2026 at 6:32 AM Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> wrote:

> On Thu, Oct 22, 2026 at 6:47 AM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
> wrote:
>
>> I agree that this is for master-only as well. Could you add it to the
>> upcoming commitfest. I'd like to review it next month.
>
>
> Thank you for looking into this, Etsuro.
> Added to the commitfest: https://commitfest.postgresql.org/patch/7502/
>
> Thanks,
> Baji Shaik.
>

Attachment Content-Type Size
out_e2e_patched.txt text/plain 5.3 KB
out_plain_patched.txt text/plain 2.7 KB
out_plain_unpatched.txt text/plain 2.8 KB
out_e2e_unpatched.txt text/plain 5.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Artem Gavrilov 2026-10-22 15:12:17 [PG19] pg_dump marks extended statistics of pre-v15 partitioned tables as non-inherited
Previous Message David Geier 2026-10-22 14:53:09 Re: Hash a ScalarArrayOpExpr whose array is fixed for one execution