Re: Add a bound check to TidRangeEval

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add a bound check to TidRangeEval
Date: 2025-06-09 01:52:02
Message-ID: CAApHDvpbcmZhJ+92pWeOYsTsZq4qJyb0qnHAWo+0ox1SjDvyzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 8 Jun 2025 at 21:41, Junwang Zhao <zhjwpku(at)gmail(dot)com> wrote:
> The comments of TidRangeEval saids:
>
> ```
> Returns false if we detect the range cannot contain any tuples.
> ```
>
> After narrowing the upper and lower bounds, we can add an
> additional check to verify if the lower bound exceeds the
> upper bound. If true, return false to avoid unnecessary calls
> to table_beginscan_tidrange.

Do you think this is common enough to bother doing? It's not like
this is going on in the planner and allows further optimisations in
regards to row estimates to assist in join order decisions.

Also, if you're going to propose a performance optimisation, then it
should also come with some benchmark code and results to demonstrate
that there is a gain in performance. I don't think it should be up to
the reviewer or committer to do that for you. I imagine it's not
exciting enough to bother with, but feel free to prove that I'm wrong.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-06-09 01:58:13 Re: Add new wait event to XactLockTableWait
Previous Message David Rowley 2025-06-09 01:36:56 Re: [PATCH] Re: Proposal to Enable/Disable Index using ALTER INDEX