Re: Returning nbtree posting list TIDs in DESC order during backwards scans

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Victor Yegorov <vyegorov(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Returning nbtree posting list TIDs in DESC order during backwards scans
Date: 2025-12-11 01:51:24
Message-ID: CAH2-WzmqUpoVVZEu51SOpcxf9OvueLnzr1yE0ZMmcNHarDdFPw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 10, 2025 at 5:33 PM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> I did have a comment like that at one point, but I felt that it didn't
> quite make sense to keep it. Such a comment would address how things
> used to work, not how they work now (also how they really should have
> worked all along).

On second thought, you (Victor) had this right: we really should have
such a comment.

I must have forgotten that the loop in _bt_killitems doesn't iterate
through so->currPos.items[] directly; it iterates through
killedItems[]. Earlier versions of the patch (that fully got rid of
killedItems) *directly* looped over so->currPos.items[], but the
committed version doesn't work that way.

I pushed a commit just now that adds a comment to clarify the
situation. It specifically mentions posting list tuples, per your
suggestion. (The commit also adds a documenting assertion to verify
leaf page order within the _bt_killitems loop.)

Thanks
--
Peter Geoghegan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2025-12-11 01:57:51 Re: log_min_messages per backend type
Previous Message Euler Taveira 2025-12-11 01:27:53 Re: not translating backend types for ps and log_line_prefix