Re: Suboptimal query plans for BETWEEN SYMMETRIC operations - Mailing list pgsql-bugs

From David Rowley
Subject Re: Suboptimal query plans for BETWEEN SYMMETRIC operations
Date
Msg-id CAApHDvpGOi0=bDp3jVB6YXTxSNdvt082uNmPK15LaYyD9HT1+Q@mail.gmail.com
Whole thread Raw
In response to Suboptimal query plans for BETWEEN SYMMETRIC operations  (Mineharu Takahara <mtakahara@yugabyte.com>)
Responses Re: Suboptimal query plans for BETWEEN SYMMETRIC operations
List pgsql-bugs
On Fri, 8 Nov 2024 at 08:36, Mineharu Takahara <mtakahara@yugabyte.com> wrote:
> A condition: "col BETWEEN SYMMETRIC val1 AND val2" is currently rewritten to "(((col >= val1) AND (col <= val2)) OR
((col>= val2) AND (col <= val1)))" that would lead to suboptimal plans using an extra Bitmap Index Scan or Index
Scan/IndexOnly Scan with the entire predicate placed in the "Filter" instead of "Index Cond". 

This isn't a bug, it's just something that could perhaps be made more optimal.

If you're interested in making improvements in this area for core
PostgreSQL, then pgsql-hackers is the place to discuss that.

David



pgsql-bugs by date:

Previous
From: Noah Misch
Date:
Subject: Re: Leader backend hang on IPC/ParallelFinish when LWLock held at parallel query start
Next
From: Tom Lane
Date:
Subject: Re: Suboptimal query plans for BETWEEN SYMMETRIC operations