Re: PG 18 JIT regression: int4range hash breaks multi-key GROUP BY

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, Tor Erik Linnerud <tel(at)jklm(dot)no>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: PG 18 JIT regression: int4range hash breaks multi-key GROUP BY
Date: 2026-11-17 23:14:10
Message-ID: CAApHDvrJG82iGnZ_h2L_O+hoN+Mb5A1iAyePyp7s=W3oOEDy0Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 18 Nov 2026 at 03:49, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> writes:
> > Should we be adding a test case for this? Basically comparing
> > HashAgg / multi-batch HashJoin output order with jit on/off.
>
> That's not gonna work on BF animals without JIT.

I don't think that's really the issue here. Those animals are free to
do something with SET jit=1; then the same thing again with SET jit=0;
and compare the two. They'd just be doing the same thing each time and
the tests probably would never fail.

IMO, the problems are:

1) There is no way to get the hash value of an ExprState directly in
SQL; therefore;
2) The only current way to test this is to create a test that checks
for slow performance or a Hash Aggregate or Hash Join, and doing that
is a terrible idea.

For #1, it might be possible to do a test module with a function like
CREATE FUNCTION test_hash_exprs(seed int4, strict bool, VARIADIC
"any") which takes the variadic args and uses ExecBuildHash32Expr() to
build an ExprState and returns the hashvalue / isnull result. I guess
then we could run that on a table with a few columns and insert into a
temp table, then run again with jit=1 and check the results match.
Perhaps the function could even create two ExprStates, one with a
faked-up PlanState to trick jit_compile_expr() into compiling the
expression when there's a JIT provider. It could then return both
values and allow the caller to compare them.

I had an LLM draft most of that up locally. I'm just wondering if it's
worth pursuing or not.

David

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-11-17 23:42:23 Re: PG 18 JIT regression: int4range hash breaks multi-key GROUP BY
Previous Message Zsolt Parragi 2026-11-17 21:37:05 Re: Two issues with REFRESH MATERIALIZED VIEW CONCURRENTLY