Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5824~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5824
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Dec 10, 2025

  1. Return TIDs in desc order during backwards scans.

    Always return TIDs in descending order when returning a group of
    duplicates to the scan whose TIDs come from an nbtree posting list
    tuples during nbtree backwards scans.  This makes backwards scans tend
    to require fewer buffer hits, since the scan is less likely to
    repeatedly pin and unpin the same heap page/buffer (we'll get exactly as
    many buffer hits as we get with a similar forwards scan case).
    
    Commit 0d861bb, which added nbtree deduplication, originally did things
    this way to avoid interfering with _bt_killitems's previous approach to
    setting LP_DEAD bits on posting list tuples.  _bt_killitems made a soft
    assumption that it can iterate through posting lists in TID order,
    finding corresponding killItems[]/so->currPos.items[] entries in that
    same order (even when scanning backwards).  This worked out because of
    the prior _bt_readpage backwards scan behavior.  If we just change the
    backwards scan posting list logic in _bt_readpage, and don't alter
    _bt_killitems itself, we'll break its soft assumption.
    
    Avoid that problem by sorting the so->killedItems[] array at the start
    of _bt_killitems.  That way the order that dead items are saved in from
    btgettuple can't matter; so->killedItems[] will always be in the same
    order as so->currPos.items[] in the end.  Since so->currPos.items[] is
    now always in leaf page order, regardless of the scan direction used
    within _bt_readpage, and since so->killedItems[] is always in that same
    order, the _bt_killitems loop can continue to make a uniform assumption
    about everything being in page order.
    
    Also deduplicate the so->killedItems[] array after it is sorted.  That
    way there's no risk of the _bt_killitems loop becoming confused by
    duplicate dead items/TID.  This was possible in cases that involved a
    scrollable cursor that encountered the same dead TID more than once
    (within the same leaf page/so->currPos context).  This doesn't matter
    very much in practice, but it seems best to be as consistent as possible
    about LP_DEAD marking items within _bt_killitems.
    
    Author: Peter Geoghegan <[email protected]>
    Reviewed-By: Mircea Cadariu <[email protected]>
    Reviewed-By: Victor Yegorov <[email protected]>
    Discussion: https://postgr.es/m/CAH2-Wz=Wut2pKvbW-u3hJ_LXwsYeiXHiW8oN1GfbKPavcGo8Ow@mail.gmail.com
    petergeoghegan authored and Commitfest Bot committed Dec 10, 2025
    Configuration menu
    Copy the full SHA
    3d3b2b2 View commit details
    Browse the repository at this point in the history
  2. [CF 5824] v5 - Returning nbtree posting list TIDs in DESC order durin…

    …g backwards scans
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5824
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CAH2-Wznq0zWu5bMEmaFZ+s3mkNpHZm-nAD=7yx_eS4t3=jZEUA@mail.gmail.com
    Author(s): Peter Geoghegan
    Commitfest Bot committed Dec 10, 2025
    Configuration menu
    Copy the full SHA
    7498652 View commit details
    Browse the repository at this point in the history
Loading