Re: Useless LEFT JOIN breaks MIN/MAX optimization

2025-05-12 Thread Alena Rybakina
On 12.05.2025 14:05, Tom Lane wrote: Robert Haas writes: But that's also assuming that you're correct here about how to descend through a JoinExpr, which I'm not quite sure whether is true. It's also assuming that we should solve the problem here rather than in some other part of the code e.g.

Re: Useless LEFT JOIN breaks MIN/MAX optimization

2025-05-12 Thread Tom Lane
Robert Haas writes: > But that's also assuming that you're correct here about how to descend > through a JoinExpr, which I'm not quite sure whether is true. It's > also assuming that we should solve the problem here rather than in > some other part of the code e.g. the join removal code, and I'm n

Re: Useless LEFT JOIN breaks MIN/MAX optimization

2025-05-09 Thread Alena Rybakina
Hi, Robert! On 09.05.2025 20:12, Robert Haas wrote: If I understand correctly, the problem here is that join removal and minmax aggregates don't work well together: after join removal runs, we end up with a state that doesn't permit the minmax-aggregate code to work. Yes, it is correct. I agre

Re: Useless LEFT JOIN breaks MIN/MAX optimization

2025-05-09 Thread Robert Haas
Hi Alena, If I understand correctly, the problem here is that join removal and minmax aggregates don't work well together: after join removal runs, we end up with a state that doesn't permit the minmax-aggregate code to work. I agree that would be good to fix but the patch doesn't seem right to m