Re: BUG #18905: The opposite WHERE clause intersects and is always an empty set. It should perform no action. - Mailing list pgsql-bugs

From Christophe Pettus
Subject Re: BUG #18905: The opposite WHERE clause intersects and is always an empty set. It should perform no action.
Date
Msg-id 2D956CA2-F876-48BA-B12E-FB9FD81F4AE5@thebuild.com
Whole thread Raw
In response to Re: BUG #18905: The opposite WHERE clause intersects and is always an empty set. It should perform no action.  ("赖锦辉" <jh.lai@qq.com>)
List pgsql-bugs

> On Apr 27, 2025, at 10:54, 赖锦辉 <jh.lai@qq.com> wrote:
> But I don't believe this optimization is meaningless.

I don't believe anyone claims this is "meaningless."

Every condition the planner has to check for adds complexity and time to the planner.  If this will provide a
significantimprovement in plans for a reasonable number of real-life cases, then it might well be worth it.  This is
especiallytrue when there is no way of writing the query without running into the issue. 

However, many proposed improvements optimize for a relatively uncommon case, but would add time and complexity for all
queries. In this case, it appears that this case is relatively uncommon, and it can be easily fixed by rewriting the
query. Given that the project does not have infinite resources to dedicate to planner improvements, it does not seem to
bean area that would reward the work put into it. 


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18904: INTERSECT with an impossible where should eliminate both from the query plan
Next
From: marcos sicat
Date:
Subject: Postgres 17.4 is much slower than Postgres 15.12 using RECURSIVE