On Fri, 8 Nov 2024 at 08:36, Mineharu Takahara <mtakahara(at)yugabyte(dot)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/Index Only 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