Hi David,

On Mon, Jun 9, 2025 at 9:52 AM David Rowley <dgrowle...@gmail.com> wrote:
>
> On Sun, 8 Jun 2025 at 21:41, Junwang Zhao <zhjw...@gmail.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.

This is not a common case, it's just a corner case while
playing around the TidRangeScan.

I'm not saying this is an optimization, it just makes me a little
confused when I see the lowerBound > upperBound and
it still returns true.

The comments say "Returns true if it's possible for the
range to contain tuples." This seems not fully accurate?

The case will be handled later while scanning the pages,
but why not handle it earlier if we already know there is no
chance of the range containing any tuples.

>
> 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.

This is not a performance optimization, so I never try to come
up with any benchmark. Sorry if I made you feel that way.

>
> David



-- 
Regards
Junwang Zhao


Reply via email to