Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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/4720~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/4720
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Apr 4, 2025

  1. Avoid extra index searches through preprocessing.

    Transform low_compare and high_compare nbtree skip array inequalities
    (with opclasses that offer skip support) in such a way as to allow
    _bt_first to consistently apply later keys when it descends the tree.
    This can lower the number of index searches for multi-column scans that
    use a ">" key on one of the index's prefix columns (or use a "<" key,
    when scanning backwards) when it precedes some later lower-order key.
    
    For example, an index qual "WHERE a > 5 AND b = 2" will now be converted
    to "WHERE a >= 6 AND b = 2" by a new preprocessing step that takes place
    after low_compare and high_compare have been finalized.  That way, the
    initial call to _bt_first can use "WHERE a >= 6 AND b = 2" to find an
    initial position, rather than just using "WHERE a > 5" -- "b = 2" can be
    applied during every _bt_first call.  There's a decent chance that this
    will allow such a scan to avoid the extra search that might otherwise be
    needed to determine the lowest "a" value still satisfying "WHERE a > 5".
    
    The transformation process can only lower the total number of index
    pages read when the use of a more restrictive set of initial positioning
    keys in _bt_first actually allows the scan to land on some later leaf
    page directly, relative to the unoptimized case (or on an earlier leaf
    page directly, when scanning backwards).  But the savings can really add
    up in cases where an affected skip array comes after some other array.
    For example, a scan indexqual "WHERE x IN (1, 2, 3) AND y > 5 AND z = 2"
    can save as many as 3 _bt_first calls by applying the new transformation
    to its "y" array (up to 1 extra search can be avoided per "x" element).
    
    Follow-up to commit 92fe23d, which added nbtree skip scan.
    
    Author: Peter Geoghegan <pg@bowt.ie>
    Reviewed-By: Matthias van de Meent <boekewurm+postgres@gmail.com>
    Discussion: https://postgr.es/m/CAH2-Wz=FJ78K3WsF3iWNxWnUCY9f=Jdg3QPxaXE=uYUbmuRz5Q@mail.gmail.com
    petergeoghegan committed Apr 4, 2025
    Configuration menu
    Copy the full SHA
    b3f1a13 View commit details
    Browse the repository at this point in the history
Loading