Re: Suboptimal query plans for BETWEEN SYMMETRIC operations

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Mineharu Takahara <mtakahara(at)yugabyte(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, "mtakahar(at)gmail(dot)com" <mtakahar(at)gmail(dot)com>
Subject: Re: Suboptimal query plans for BETWEEN SYMMETRIC operations
Date: 2024-11-07 22:58:07
Message-ID: CAApHDvpGOi0=bDp3jVB6YXTxSNdvt082uNmPK15LaYyD9HT1+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-11-07 23:22:37 Re: Suboptimal query plans for BETWEEN SYMMETRIC operations
Previous Message Noah Misch 2024-11-07 19:38:23 Re: Leader backend hang on IPC/ParallelFinish when LWLock held at parallel query start