Re: BUG #19572: Redundant predicate changes JIT decision and causes an 18x performance difference

From: "Matheus Alcantara" <matheusssilv97(at)gmail(dot)com>
To: 陈列行 <2320415112(at)qq(dot)com>, "pgsql-bugs" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19572: Redundant predicate changes JIT decision and causes an 18x performance difference
Date: 2026-07-31 11:48:29
Message-ID: DKCQEBNRSEHK.1BWKETIC2RW84@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu Jul 30, 2026 at 3:44 AM -03, =?utf-8?B?6ZmI5YiX6KGM?= wrote:
> Thanks for the detailed analysis.
>
>
> You are completely right—the query produces correct results, so it's
> an estimation/costing issue rather than a correctness bug.
>
>
> Regarding whether it's worth addressing: In real-world applications,
> especially those using ORMs or complex auto-generated SQL, redundant
> predicates (or transitive quals across joins) are actually quite
> common. When a redundant qual causes the estimated row count to drop
> significantly, it can severely distort the plan choice or prematurely
> cross cost thresholds (like JIT enablement, as seen here).
>

Yeah, I'm not surprised that ORMs may generate such queries. I've posted
about this on -hackers [1].

[1] https://www.postgresql.org/message-id/DKBX1KUW8KUW.2DU5RD192DHIQ%40gmail.com

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message ld_zju 2026-07-31 14:54:02 Re:Re: DO NOT pull up a sublink when it has no join condition with the upper relation
Previous Message David Rowley 2026-07-31 11:33:50 Re: Hash Semi Join 5,000-50,000x slower on PG18 vs PG17 with 10+ equality columns and NULL values (identical plan, no spill)