Re: Join removal and attr_needed cleanup

2025-05-20 Thread Bennie Swart
Given that some time has passed I'd like to raise this again. Any chance of this making it back to 16 to fix the regression? We'll be using 16 for the better part of a year still and we're having to resort to some annoying workarounds for this. Regards, Bennie On 2024/11/10 18:17, Tom Lane

Re: Join removal and attr_needed cleanup

2024-11-10 Thread Tom Lane
Bennie Swart writes: > -- join elimination fails > -- expect both b and c to be eliminated, but b remains > explain (costs off) >   select a.* >     from foo a >   left join foo b on (b.id1, b.id2) = (a.id1, a.id2) >   left join foo c on (c.id1, c.id2) = (a.id1, b.id2); >

Re: Join removal and attr_needed cleanup

2024-11-10 Thread Bennie Swart
We are encountering this issue which results in poor planning for some views. Some examples to illustrate the issue: -- setup create table foo as   select id1, id2     from generate_series(1, 100) id1, generate_series(1, 100) id2; alter table foo add unique (id1, id2); -- join elimina

Join removal and attr_needed cleanup

2024-04-29 Thread Antonin Houska
The attached patch tries to fix a corner case where attr_needed of an inner relation of an OJ contains the join relid only because another, already-removed OJ, needed some of its attributes. The unnecessary presence of the join relid in attr_needed can prevent the planner from further join removals