Re: BUG #18627: Regression (15 -> 16) - Join removal not performed when join condition spans multiple tables

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: gourlaouen.mikael@gmail.com, pgsql-bugs@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2024-09-22T13:45:30Z
Lists: pgsql-bugs
On Mon, 23 Sept 2024 at 00:55, PG Bug reporting form
<noreply@postgresql.org> wrote:
> Postgres 15 is able to nicely remove all the joins and gives a nice tidy
> query plan:
> ```
> Seq Scan on origin o  (cost=0.00..16.50 rows=650 width=32)
> ```
>
> Postgres 16 (and 17rc1) on the other hand are giving me this query plan
> instead:
> ```
> Hash Left Join  (cost=24.62..42.84 rows=650 width=32)

Thanks for the report.

It looks like the first bad commit is acc5821e4d (Further fixes in
qual nullingrel adjustment for outer join commutation)

I doubt breaking this was an intended change of the nullable Var work.
Tom can likely confirm.

David



Commits

  1. Recalculate where-needed data accurately after a join removal.